2017-01-19 05:51:10 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Cadence Design Systems, Inc.
|
2017-01-25 07:10:39 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2017-01-19 05:51:10 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __XTENSA_API_H__
|
|
|
|
#define __XTENSA_API_H__
|
|
|
|
|
|
|
|
#include <xtensa/hal.h>
|
|
|
|
#include "xtensa_rtos.h"
|
|
|
|
#include "xtensa_context.h"
|
|
|
|
|
|
|
|
/*
|
2017-02-11 04:58:08 +08:00
|
|
|
* Call this function to enable the specified interrupts.
|
|
|
|
*
|
|
|
|
* mask - Bit mask of interrupts to be enabled.
|
|
|
|
*/
|
2017-12-15 02:08:04 +08:00
|
|
|
#if CONFIG_XTENSA_ASM2
|
|
|
|
static inline void _xt_ints_on(unsigned int mask)
|
|
|
|
{
|
|
|
|
int val;
|
|
|
|
|
|
|
|
__asm__ volatile("rsr.intenable %0" : "=r"(val));
|
|
|
|
val |= mask;
|
|
|
|
__asm__ volatile("wsr.intenable %0; rsync" : : "r"(val));
|
|
|
|
}
|
|
|
|
#else
|
2017-01-19 05:51:10 +08:00
|
|
|
extern void _xt_ints_on(unsigned int mask);
|
2017-12-15 02:08:04 +08:00
|
|
|
#endif
|
2017-01-19 05:51:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
2017-02-11 04:58:08 +08:00
|
|
|
* Call this function to disable the specified interrupts.
|
|
|
|
*
|
|
|
|
* mask - Bit mask of interrupts to be disabled.
|
|
|
|
*/
|
2017-12-15 02:08:04 +08:00
|
|
|
#if CONFIG_XTENSA_ASM2
|
|
|
|
static inline void _xt_ints_off(unsigned int mask)
|
|
|
|
{
|
|
|
|
int val;
|
2017-01-19 05:51:10 +08:00
|
|
|
|
2017-12-15 02:08:04 +08:00
|
|
|
__asm__ volatile("rsr.intenable %0" : "=r"(val));
|
|
|
|
val &= ~mask;
|
|
|
|
__asm__ volatile("wsr.intenable %0; rsync" : : "r"(val));
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
extern void _xt_ints_off(unsigned int mask);
|
|
|
|
#endif
|
2017-01-19 05:51:10 +08:00
|
|
|
|
|
|
|
/*
|
2017-02-11 04:58:08 +08:00
|
|
|
* Call this function to set the specified (s/w) interrupt.
|
|
|
|
*/
|
2017-01-19 05:51:10 +08:00
|
|
|
static inline void _xt_set_intset(unsigned int arg)
|
|
|
|
{
|
2017-02-11 04:58:08 +08:00
|
|
|
xthal_set_intset(arg);
|
2017-01-19 05:51:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-02-11 04:58:08 +08:00
|
|
|
/* Call this function to clear the specified (s/w or edge-triggered)
|
|
|
|
* interrupt.
|
|
|
|
*/
|
2017-01-19 05:51:10 +08:00
|
|
|
static inline void _xt_set_intclear(unsigned int arg)
|
|
|
|
{
|
2017-02-11 04:58:08 +08:00
|
|
|
xthal_set_intclear(arg);
|
2017-01-19 05:51:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __XTENSA_API_H__ */
|
|
|
|
|