debug: interrupt event logger support for arc

Jira: ZEP-53
Change-Id: Id6ee505a7e89122a47fc22162b4c257ac2126d09
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
This commit is contained in:
Juan Manuel Cruz 2016-04-13 16:38:38 -05:00 committed by Anas Nashif
commit b17258b536
3 changed files with 78 additions and 0 deletions

View file

@ -211,6 +211,22 @@ SECTION_FUNC(TEXT, _isr_enter)
j_s.nd [r2]
#if defined(CONFIG_KERNEL_EVENT_LOGGER_INTERRUPT)
GTEXT(_sys_k_event_logger_interrupt)
.macro log_interrupt_k_event
clri r0 /* do not interrupt event logger operations */
push_s r0
push_s blink
jl _sys_k_event_logger_interrupt
pop_s blink
pop_s r0
seti r0
.endm
#else
#define log_interrupt_k_event
#endif
#if defined(CONFIG_NANOKERNEL) && defined(CONFIG_TICKLESS_IDLE)
.macro exit_tickless_idle
clri r0 /* do not interrupt exiting tickless idle operations */
@ -232,6 +248,7 @@ SECTION_FUNC(TEXT, _isr_demux)
/* cannot be done before this point because we must be able to run C */
/* r0 is available to be stomped here, and exit_tickless_idle uses it */
exit_tickless_idle
log_interrupt_k_event
lr r0, [_ARC_V2_ICAUSE]
sub r0, r0, 16

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2016 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @brief Kernel event logger support for ARM
*/
#ifndef __KERNEL_EVENT_LOGGER_ARCH_H__
#define __KERNEL_EVENT_LOGGER_ARCH_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Get the identification of the current interrupt.
*
* This routine obtain the key of the interrupt that is currently processed
* if it is called from a ISR context.
*
* @return The key of the interrupt that is currently being processed.
*/
int _sys_current_irq_key_get(void)
{
return _INTERRUPT_CAUSE();
}
#ifdef __cplusplus
}
#endif
#endif /* __KERNEL_EVENT_LOGGER_ARCH_H__ */

View file

@ -278,6 +278,21 @@ static ALWAYS_INLINE int _IS_IN_ISR(void)
return ((act & 0xffff) != 0);
}
/**
*
* @bried Indicates the interrupt number of the highest priority
* active interrupt
*
* @return IRQ number
*/
static ALWAYS_INLINE int _INTERRUPT_CAUSE(void)
{
uint32_t irq_num = _arc_v2_aux_reg_read(_ARC_V2_ICAUSE);
return irq_num;
}
extern void nanoCpuAtomicIdle(unsigned int);
extern void _thread_entry_wrapper(void);