📄 sh-intr.c
字号:
/* 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -