From 55c4d159825f90975aeeb4346c0e4e0c41df6f07 Mon Sep 17 00:00:00 2001 From: batt Date: Thu, 18 Oct 2007 10:46:05 +0000 Subject: [PATCH] Create a unique include file for ARM I/O registers. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@898 38d2e660-2303-0410-9eaa-f027e97ec537 --- app/at91sam7s/at91sam7s.c | 2 +- cpu/arm/drv/sysirq_at91.c | 22 +---- cpu/arm/drv/timer_at91.c | 2 +- cpu/arm/io/arm.h | 54 +++++++++++ cpu/arm/io/at91.h | 105 +++++++++++++++++++++ cpu/arm/io/{at91sam7s.h => at91sam7s256.h} | 3 +- 6 files changed, 163 insertions(+), 25 deletions(-) create mode 100644 cpu/arm/io/arm.h create mode 100644 cpu/arm/io/at91.h rename cpu/arm/io/{at91sam7s.h => at91sam7s256.h} (99%) diff --git a/app/at91sam7s/at91sam7s.c b/app/at91sam7s/at91sam7s.c index b088247f..3fa65da7 100644 --- a/app/at91sam7s/at91sam7s.c +++ b/app/at91sam7s/at91sam7s.c @@ -40,7 +40,7 @@ #include #include #include -#include +#include int iort = 23; int iort1 = 232; diff --git a/cpu/arm/drv/sysirq_at91.c b/cpu/arm/drv/sysirq_at91.c index d943e89f..e95d5a15 100644 --- a/cpu/arm/drv/sysirq_at91.c +++ b/cpu/arm/drv/sysirq_at91.c @@ -53,7 +53,7 @@ */ #include "sysirq_at91.h" -#include +#include #include #include #include @@ -86,26 +86,6 @@ static SysIrq sysirq_tab[] = STATIC_ASSERT(countof(sysirq_tab) == SYSIRQ_CNT); -/*! - * \brief Interrupt entry. - */ -#define IRQ_ENTRY() \ - asm volatile("sub lr, lr,#4" "\n\t" /* Adjust LR */ \ - "stmfd sp!,{r0-r12,lr}" "\n\t" /* Save registers on IRQ stack. */ \ - "mrs r1, spsr" "\n\t" /* Save SPSR */ \ - "stmfd sp!,{r1}" "\n\t") /* */ - -/*! - * \brief Interrupt exit. - */ -#define IRQ_EXIT() \ - asm volatile("ldmfd sp!, {r1}" "\n\t" /* Restore SPSR */ \ - "msr spsr_c, r1" "\n\t" /* */ \ - "ldr r0, =0xFFFFF000" "\n\t" /* End of interrupt. */ \ - "str r0, [r0, #0x130]" "\n\t" /* */ \ - "ldmfd sp!, {r0-r12, pc}^" "\n\t") /* Restore registers and return. */ - - /** * System IRQ dispatcher. * This is the entry point for all system IRQs in AT91. diff --git a/cpu/arm/drv/timer_at91.c b/cpu/arm/drv/timer_at91.c index cfc81c76..efe37d5a 100644 --- a/cpu/arm/drv/timer_at91.c +++ b/cpu/arm/drv/timer_at91.c @@ -38,7 +38,7 @@ */ #include "timer_at91.h" -#include +#include #include "sysirq_at91.h" #include // BV() diff --git a/cpu/arm/io/arm.h b/cpu/arm/io/arm.h new file mode 100644 index 00000000..5690c317 --- /dev/null +++ b/cpu/arm/io/arm.h @@ -0,0 +1,54 @@ +/** + * \file + * + * + * \version $Id$ + * + * \author Francesco Sacchi + * + * ARM I/O registers. + */ + + +#ifndef ARM_H +#define ARM_H + +#include + +#if CPU_ARM_AT91 + #include "at91.h" +/*#elif Add other ARM families here */ +#else + #error Unknown CPU +#endif + + +#endif /* ARM_H */ diff --git a/cpu/arm/io/at91.h b/cpu/arm/io/at91.h new file mode 100644 index 00000000..c16bfdf4 --- /dev/null +++ b/cpu/arm/io/at91.h @@ -0,0 +1,105 @@ +/** + * \file + * + * + * \version $Id$ + * + * \author Francesco Sacchi + * + * AT91 common definitions. + * This file is based on NUT/OS implementation. See license below. + */ + +/* + * Copyright (C) 2006-2007 by egnite Software GmbH. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holders nor the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE + * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * For additional information see http://www.ethernut.de/ + */ + +#ifndef AT91_H +#define AT91_H + +#include + +/** + * Interrupt entry point. + * Needed because AT91 uses an Interrupt Controlled with auto-vectoring. + */ +#define IRQ_ENTRY() \ + asm volatile("sub lr, lr,#4" "\n\t" /* Adjust LR */ \ + "stmfd sp!,{r0-r12,lr}" "\n\t" /* Save registers on IRQ stack. */ \ + "mrs r1, spsr" "\n\t" /* Save SPSR */ \ + "stmfd sp!,{r1}" "\n\t") /* */ + +/** + * Interrupt exit. + * Needed because AT91 uses an Interrupt Controlled with auto-vectoring. + */ +#define IRQ_EXIT() \ + asm volatile("ldmfd sp!, {r1}" "\n\t" /* Restore SPSR */ \ + "msr spsr_c, r1" "\n\t" /* */ \ + "ldr r0, =0xFFFFF000" "\n\t" /* End of interrupt. */ \ + "str r0, [r0, #0x130]" "\n\t" /* */ \ + "ldmfd sp!, {r0-r12, pc}^" "\n\t") /* Restore registers and return. */ + +#if CPU_ARM_AT91SAM7S256 + #include "at91sam7s256.h" +#else + #error Missing I/O definitions for CPU. +#endif + +#endif /* AT91_H */ diff --git a/cpu/arm/io/at91sam7s.h b/cpu/arm/io/at91sam7s256.h similarity index 99% rename from cpu/arm/io/at91sam7s.h rename to cpu/arm/io/at91sam7s256.h index 24e9580e..6c22208e 100644 --- a/cpu/arm/io/at91sam7s.h +++ b/cpu/arm/io/at91sam7s256.h @@ -34,7 +34,7 @@ * * \author Francesco Sacchi * - * AT91SAM7S register definitions. + * AT91SAM7S256 register definitions. * This file is based on NUT/OS implementation. See license below. */ @@ -109,7 +109,6 @@ #include "at91_wdt.h" #include "at91_rstc.h" #include "at91_pio.h" -#include "at91_ser.h" //TODO: add other peripherals /** Peripheral Identifiers and Interrupts */ -- 2.25.1