Added routines to enable/disable interrupts for Patmos

This commit is contained in:
afpr
2014-03-18 12:21:40 +00:00
parent 5d4ed4e3ce
commit 4626a8b696
11 changed files with 122 additions and 11 deletions

View File

@@ -2,12 +2,12 @@
AC_DEFUN([RTEMS_CHECK_BSPDIR],
[
case "$1" in
TLL6527M )
AC_CONFIG_SUBDIRS([TLL6527M]);;
bf537Stamp )
AC_CONFIG_SUBDIRS([bf537Stamp]);;
eZKit533 )
AC_CONFIG_SUBDIRS([eZKit533]);;
TLL6527M )
AC_CONFIG_SUBDIRS([TLL6527M]);;
*)
AC_MSG_ERROR([Invalid BSP]);;
esac

View File

@@ -46,5 +46,8 @@ libbsp_a_SOURCES += clock/ckinit.c ../../../shared/clockdrv_shell.h
# timer
libbsp_a_SOURCES += timer/timer.c
libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/cache.rel \
../../../libcpu/@RTEMS_CPU@/exceptions.rel
include $(srcdir)/preinstall.am
include $(top_srcdir)/../../../../automake/local.am

View File

@@ -245,8 +245,7 @@ rtems_isr Clock_isr(
* load general-purpose registers from the shadow stack
* load special-purpose registers from the shadow stack cache
*/
asm volatile("restore_context: \n\t"
"lwc $r0 = [ $r31 + %0 ] \n\t" //load r0
asm volatile("lwc $r0 = [ $r31 + %0 ] \n\t" //load r0
"lwc $r2 = [ $r31 + %1 ] \n\t" //load r2
"lwc $r3 = [ $r31 + %2 ] \n\t" //load r3
"lwc $r4 = [ $r31 + %3 ] \n\t" //load r4
@@ -377,6 +376,8 @@ void Clock_exit( void )
{
/* XXX: turn off the timer interrupts */
patmos_disable_interrupts();
/* XXX: If necessary, restore the old vector */
}

View File

@@ -175,6 +175,29 @@ extern uint64_t get_cpu_time(void);
* End of RTC Management
*/
/*
* Exception Management
*/
extern char _excunit_base; /* linker symbol giving the base address of the exception handling unit */
/* The status register of the exception unit */
#define EXC_STATUS (*((_iodev_ptr_t)(&_excunit_base+0x00)))
/* The interrupt mask register */
#define EXC_MASK (*((_iodev_ptr_t)(&_excunit_base+0x04)))
/* The pending interrupts register */
#define EXC_PEND (*((_iodev_ptr_t)(&_excunit_base+0x08)))
/* The exception source register */
#define EXC_SOURCE (*((_iodev_ptr_t)(&_excunit_base+0x0c)))
/*
* End of Exception Management
*/
#endif /* !ASM */
#ifdef __cplusplus

View File

@@ -1,14 +1,17 @@
##
## $Id: Makefile.am,v 1.00 2013/06/14 15:17:12 André Rocha $
## $Id: Makefile.am,v 1.00 2013/06/14 15:17:12 Andre Rocha $
##
ACLOCAL_AMFLAGS = -I ../../../aclocal
include $(top_srcdir)/../../../automake/compile.am
noinst_PROGRAMS =
include_libcpudir = $(includedir)/libcpu
## cache
include_libcpu_HEADERS = ../shared/include/cache.h
noinst_PROGRAMS += cache.rel
@@ -21,5 +24,13 @@ if has_instruction_cache
cache_rel_CPPFLAGS += -DHAS_INSTRUCTION_CACHE
endif
## exceptions
include_libcpu_HEADERS += exceptions/exceptions.h
noinst_PROGRAMS += exceptions.rel
exceptions_rel_SOURCES = exceptions/exceptions.c
exceptions_rel_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/exceptions
exceptions_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
include $(srcdir)/preinstall.am
include $(top_srcdir)/../../../automake/local.am

View File

@@ -13,6 +13,11 @@
/* XXX these need to be addressed */
void _CPU_cache_invalidate_entire_instruction ( void )
{
<<<<<<< HEAD
=======
// No flush instruction at the moment
//asm volatile ("flush");
>>>>>>> 0524f11f213c4b1a72cf113f24422977a9bae877
}
void _CPU_cache_freeze_instruction ( void )

View File

@@ -0,0 +1,35 @@
/*
* Exceptions
*
* This module implements functions to handle exceptions in Patmos
*
*
* Project: T-CREST - Time-Predictable Multi-Core Architecture for Embedded Systems
*
* Copyright (C) GMVIS Skysoft S.A., 2014
* @author Andre Rocha
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
*/
#include <stdlib.h>
#include <rtems.h>
#include <bsp.h>
/*
* Enable interrupts
*/
void patmos_enable_interrupts(void){
EXC_STATUS |= 1;
}
/*
* Disable interrupts
*/
void patmos_disable_interrupts(void){
EXC_STATUS &= ~1;
}

View File

@@ -0,0 +1,23 @@
/*
* Patmos Exception Management
*
* Project: T-CREST - Time-Predictable Multi-Core Architecture for Embedded Systems
*
* Copyright (C) GMVIS Skysoft S.A., 2014
* @author Andre Rocha
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifndef __PATMOS_EXCEPTIONS_h
#define __PATMOS_EXCEPTIONS_h
void patmos_enable_interrupts(void);
void patmos_disable_interrupts(void);
#endif
/* end of include file */

View File

@@ -22,3 +22,7 @@ $(PROJECT_INCLUDE)/libcpu/cache.h: ../shared/include/cache.h $(PROJECT_INCLUDE)/
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/cache.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/cache.h
$(PROJECT_INCLUDE)/libcpu/exceptions.h: exceptions/exceptions.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/exceptions.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/exceptions.h

View File

@@ -9,7 +9,7 @@
* Project: T-CREST - Time-Predictable Multi-Core Architecture for Embedded Systems
*
* Copyright (C) GMVIS Skysoft S.A., 2013
* @author André Rocha
* @author Andre Rocha
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -564,7 +564,8 @@ SCORE_EXTERN volatile uint32_t _CPU_ISR_Dispatch_disable;
* level is returned in _level.
*/
#define _CPU_ISR_Disable( _level )
#define _CPU_ISR_Disable( _level ) \
patmos_disable_interrupts()
/*
* Enable interrupts to the previous level (returned by _CPU_ISR_Disable).
@@ -572,7 +573,8 @@ SCORE_EXTERN volatile uint32_t _CPU_ISR_Dispatch_disable;
* _level is not modified.
*/
#define _CPU_ISR_Enable( _level )
#define _CPU_ISR_Enable( _level ) \
patmos_enable_interrupts()
/*
* This temporarily restores the interrupt to _level before immediately

View File

@@ -9,7 +9,7 @@
* Project: T-CREST - Time-Predictable Multi-Core Architecture for Embedded Systems
*
* Copyright (C) GMVIS Skysoft S.A., 2013
* @author André Rocha
* @author Andre Rocha
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -24,9 +24,13 @@
extern "C" {
#endif
#ifndef ASM
#include <libcpu/exceptions.h>
#endif
/*
* This file contains the information required to build
* RTEMS for a particular member of the "patmos" family. It does
* RTEMS for a particular member of the Patmos family. It does
* this by setting variables to indicate which implementation
* dependent features are present in a particular member
* of the family.