sh-intr.c

来自「this is ipl loader for hitachi SH4 proce」· C语言 代码 · 共 109 行

C
109
字号
/* sh-intr.c: Interrupt functions for SH7750 * *  Copyright (C) 2001 KOMORIYA Takeru * * 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 file "GPL" for more details. * * Contact to author: *   KOMORIYA Takeru, AAF Sendai Lab., Japan *   E-mail: komoriya@chmodx.dyndns.org *      URL: http://chmodx.dyndns.org/aaf/ */#include "sh7750.h"#include "sh-intr.h"/* Dummy function; do nothing */voidintr_noop (void) {}/* Interrupt jump table */void * interrupt_table[60] = {  0,         0,         0,         0,         0,  0,         0,         0,         0,         0,  0,         0,         0,         0,         0,  0,         intr_noop, intr_noop, intr_noop, intr_noop,   intr_noop, intr_noop, intr_noop, intr_noop, intr_noop,   intr_noop, intr_noop, intr_noop, intr_noop, intr_noop,   intr_noop, intr_noop, intr_noop, intr_noop, intr_noop,   intr_noop, intr_noop, intr_noop, intr_noop, intr_noop,   intr_noop, intr_noop, intr_noop, intr_noop, intr_noop,   intr_noop, intr_noop, intr_noop, intr_noop, intr_noop,   intr_noop, intr_noop, intr_noop, intr_noop, intr_noop,   intr_noop, intr_noop, intr_noop, intr_noop, intr_noop};/* Backup for interrupt jump table */void * interrupt_table_bak[60] = {  0, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0, 0, 0, 0, 0,  0, 0, 0, 0, 0};/* Register interrupt */intintr_register (int intr, void *function){  if( interrupt_table_bak[intr] == 0 ){    interrupt_table_bak[intr] = interrupt_table[intr];    interrupt_table[intr] = function;    return 0; /* Success */  }  return -1; /* Already registered */}/* Unregister interrupt */intintr_unregister (int intr){  if( interrupt_table_bak[intr] != 0 ){    interrupt_table[intr] = interrupt_table_bak[intr];    interrupt_table_bak[intr] = 0;    return 0; /* Success */  }  return -1; /* Not registered */}/* Set priority for peripheral modules   pri: (High) 15 <---> 1 (Low), 0 : Masked  */voidintr_set_priority (int intr, int pri){  unsigned int ipr, mask, shift;  ipr = intr >> 4;  shift = intr & 0x0f;  mask = 0xf << shift;  switch (ipr)    {    case 0:      IPRA = (IPRA & ~mask) | (pri << shift);      break;    case 1:      IPRB = (IPRB & ~mask) | (pri << shift);      break;    case 2:      IPRC = (IPRC & ~mask) | (pri << shift);      break;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?