?? idle.c
字號(hào):
/* * dspapps/dsp/tokliBIOS/idle.c * * DSP idle TSK function * * Copyright (C) 2003 Nokia Corporation * * Written by Kiyotaka Takahashi <kiyotaka.takahashi@nokia.com> * Written by Toshihiro Kobayashi <toshihiro.kobayashi@nokia.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: idle.c * $Revision: 2.0 * $Date: 2003/11/11 * */#include <std.h>#include "omap1510.h"// #8: HOM_P, #9: HOM_R#define go_SAM() \ do {\ asm(" BCLR #8, ST3_55;");\ asm(" BCLR #9, ST3_55;");\ } while(0)#define go_HOM() \ do {\ asm(" BSET #8, ST3_55;");\ asm(" BSET #9, ST3_55;");\ } while(0)static Uns icr_mask = 0;static Uns icr_idle = 0;#ifdef DEBUG_WAKEUP_CNTstatic LgUns wakeup_cnt = 0;#endif /* DEBUG_WAKEUP_CNT *//* * !!! note: this routine cannot be placed in external RAM !!! */Void sleep_dsp(Void){ Uns intm_saved; while(1) { wdt_reflesh(); if(icr_idle == 0) continue; wdt_stop();// timer1_stop(); intm_saved = HWI_disable(); go_SAM(); outw(icr_idle, _ICR); go_HOM(); asm(" IDLE;"); if(!(icr_idle & _ICR_BIT_CPU_IDLE_DOMAIN)) { /* * if CPU domain does not stop, * we should stay here until * any enabled interrupt comes. * (if CPU stops, this is done by HW.) */ while(!(*_IFR0 & *_IER0) && !(*_IFR1 & *_IER1 & 0x00ff)) {} } go_SAM(); outw(0, _ICR); asm(" IDLE;"); HWI_restore(intm_saved);// timer1_start(); wdt_start();#ifdef DEBUG_WAKEUP_CNT wakeup_cnt++;#endif /* DEBUG_WAKEUP_CNT */ }}Uns get_icr_mask(Void){ return icr_mask;}Void set_icr_mask(Uns val){ icr_mask = val; /* * ICR value when going idle */ icr_idle = (_ICR_BIT_EMIF_IDLE_DOMAIN | _ICR_BIT_DPLL_IDLE_DOMAIN | _ICR_BIT_PER_IDLE_DOMAIN | _ICR_BIT_CACHE_IDLE_DOMAIN | _ICR_BIT_DMA_IDLE_DOMAIN | _ICR_BIT_CPU_IDLE_DOMAIN) & icr_mask; /* * if CPU won't stop, DPLL shouldn't stop. */ if(!(icr_idle & _ICR_BIT_CPU_IDLE_DOMAIN)) icr_idle &= ~_ICR_BIT_DPLL_IDLE_DOMAIN; /* * FIXME: * if DMA stays alive (DMA and DPLL domain doesn't stop), * any other domain shouln't stop. */ if(!(icr_idle & _ICR_BIT_DPLL_IDLE_DOMAIN) && !(icr_idle & _ICR_BIT_DMA_IDLE_DOMAIN)) icr_idle = 0;}Void init_icr(Void){#if 0 /* * all domains stop when idle */ set_icr_mask(_ICR_BIT_EMIF_IDLE_DOMAIN | _ICR_BIT_DPLL_IDLE_DOMAIN | _ICR_BIT_PER_IDLE_DOMAIN | _ICR_BIT_CACHE_IDLE_DOMAIN | _ICR_BIT_DMA_IDLE_DOMAIN | _ICR_BIT_CPU_IDLE_DOMAIN);#else /* * We do nothing here. GPP takes care about this. */ set_icr_mask(0);#endif}#ifdef DEBUG_WAKEUP_CNTLgUns get_wakeup_cnt(Void){ return wakeup_cnt;}Void clear_wakeup_cnt(Void){ wakeup_cnt = 0;}#endif /* DEBUG_WAKEUP_CNT */
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -