From a26b7ac4bac7e08a42cd37c146c3cb3ad41d136f Mon Sep 17 00:00:00 2001 From: Thomas Eichinger Date: Tue, 22 Oct 2013 12:57:09 +0200 Subject: [PATCH] remove isr.c to change interrupt handling to VIC model --- cpu/mc1322x/Makefile | 2 -- cpu/mc1322x/isr.c | 75 ------------------------------------------- cpu/mc1322x/startup.s | 60 ++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 77 deletions(-) delete mode 100644 cpu/mc1322x/isr.c diff --git a/cpu/mc1322x/Makefile b/cpu/mc1322x/Makefile index 9af5768212..706aac84a5 100644 --- a/cpu/mc1322x/Makefile +++ b/cpu/mc1322x/Makefile @@ -8,8 +8,6 @@ ifneq (,$(findstring mc1322x_asm,$(USEMODULE))) DIRS += asm endif -CFLAGS = $(CFLAGS_BASIC) - all: $(BINDIR)$(MODULE).a @for i in $(DIRS) ; do "$(MAKE)" -C $$i ; done ; diff --git a/cpu/mc1322x/isr.c b/cpu/mc1322x/isr.c deleted file mode 100644 index 2d465489dc..0000000000 --- a/cpu/mc1322x/isr.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * isr.c - mc1322x specific isr - * Copyright (C) 2013 Thomas Eichinger - * - * This source code is licensed under the GNU Lesser General Public License, - * Version 2. See the file LICENSE for more details. - * - * This file is part of RIOT. - */ - -#include "mc1322x.h" - -static void (*tmr_isr_funcs[4])(void) = { - tmr0_isr, - tmr1_isr, - tmr2_isr, - tmr3_isr -}; - -void irq_register_timer_handler(int timer, void (*isr)(void)) -{ - tmr_isr_funcs[timer] = isr; -} - - -__attribute__ ((section (".irq"))) -__attribute__ ((interrupt("IRQ"))) -void irq(void) -{ - while ((ITC->NIPEND)) { - - if(ITC->NIPENDbits.TMR) { - /* dispatch to individual timer isrs if they exist */ - /* timer isrs are responsible for determining if they */ - /* caused an interrupt */ - /* and clearing their own interrupt flags */ - if (tmr_isr_funcs[0] != 0) { (tmr_isr_funcs[0])(); } - if (tmr_isr_funcs[1] != 0) { (tmr_isr_funcs[1])(); } - if (tmr_isr_funcs[2] != 0) { (tmr_isr_funcs[2])(); } - if (tmr_isr_funcs[3] != 0) { (tmr_isr_funcs[3])(); } - } - - if(ITC->NIPENDbits.MACA) { - if(maca_isr != 0) { maca_isr(); } - } - if(ITC->NIPENDbits.UART1) { - if(uart1_isr != 0) { uart1_isr(); } - } - if(ITC->NIPENDbits.UART2) { - if(uart2_isr != 0) { uart2_isr(); } - } - if(ITC->NIPENDbits.CRM) { - // if(rtc_wu_evt() && (rtc_isr != 0)) { rtc_isr(); } - // if(kbi_evnt(4) && (kbi4_isr != 0)) { kbi4_isr(); } - // if(kbi_evnt(5) && (kbi5_isr != 0)) { kbi5_isr(); } - // if(kbi_evnt(6) && (kbi6_isr != 0)) { kbi6_isr(); } - // if(kbi_evnt(7) && (kbi7_isr != 0)) { kbi7_isr(); } - - if (CRM->STATUSbits.CAL_DONE && CRM->CAL_CNTLbits.CAL_IEN && cal_isr) - { - CRM->STATUSbits.CAL_DONE = 0; - cal_isr(); - } - } - if(ITC->NIPENDbits.ASM) { - if(asm_isr != 0) { asm_isr(); } - } - if (ITC->NIPENDbits.I2C) { - if (i2c_isr != 0) { i2c_isr(); } - } - - ITC->INTFRC = 0; /* stop forcing interrupts */ - - } -} diff --git a/cpu/mc1322x/startup.s b/cpu/mc1322x/startup.s index 4ebc294e54..07f2c08a14 100644 --- a/cpu/mc1322x/startup.s +++ b/cpu/mc1322x/startup.s @@ -1,3 +1,63 @@ +/* + * Copyright (c) 2010, Mariano Alvira and other contributors + * to the MC1322x project (http:/*mc1322x.devl.org) and Contiki. + * + * 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 Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 THE INSTITUTE 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. + * + * This file is part of the Contiki OS. + * + * + */ + + +/* +The following lincence is for all parts of this code done by +Martin Thomas. Code from others used here may have other license terms. + +Copyright (C) 2004 Martin THOMAS + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +! The above copyright notice and this permission notice shall be included in all +! copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + /* * startup.s - mc1322x specific startup code * Copyright (C) 2013 Thomas Eichinger