test_swi.c

来自「arm9.rar」· C语言 代码 · 共 76 行

C
76
字号
//====================================================================
// File Name : 2410swi.c
// Function  : S3C2410 SWI Test
// Program   : Shin, On Pil (SOP)
// Date      : March 20, 2002
// Version   : 0.0
// History
//   0.0 : Programming start (March 12, 2002) -> SOP
//====================================================================

#include "def.h"
//#include "option.h"
#include "2410addr.h"
//#include "2410lib.h"
//#include "2410slib.h" 
#include "2410swi.h"
#include "2410swis.h"
#include "board.h"
#include "utils.h"

void SerialTxEmpty(void);

#define	Uart_Printf			printf
#define	Uart_TxEmpty(ch)	SerialTxEmpty()


__swi(0x87) void SwiTest(void);

int swiVar;

//----------------------------------------------------------------------
void __irq Isr_SwiTest(void)
{
    rINTMSK = rINTMSK | BIT_UART0;
    ClearPending(BIT_UART0);    
    SwiTest();
    swiVar++;

}

//**********************[Test_SwiIrq ]***********************************
void Test_SwiIrq(void)
{
    int i;
    U32 swi_save = pISR_SWI;
    
    swiVar = 1;
    
    Uart_Printf("rUCON0 = %x\n",rUCON0);
    Uart_Printf("[ SWI Test ]\n");
    Uart_Printf("swiVar = %d\n",swiVar);
    Uart_TxEmpty(0);
      //UART0 Tx interrupt bit in rINTPND will be set.
    pISR_UART0 = (U32)Isr_SwiTest;
    pISR_SWI   = (U32)SWI_ISR;
    rINTMSK    = rINTMSK & ~(BIT_UART0);
    for(i=0;i<10000;i++);
    rINTMSK = rINTMSK | BIT_UART0;
    Uart_Printf("swiVar = %d\n",swiVar);
    
    pISR_SWI = swi_save;
    
    puts("press any key to continue...\n");
    getch();
}

static char title[] = "SWI实验";
static char tip[]   = "SWI软件中断实验,按ESC键返回";

//Test_SwiIrq_Item 在 prog_entry.c 里被引用
TEST_PROGRAM_ITEM Test_SwiIrq_Item = {
				(TEST_PROGRAM)Test_SwiIrq, 	//入口地址
				title, 					//显示名称
				tip, 					//帮助或提示信息,可为NULL
				1};						//使用printf,puts,putch等函数时在LCD上也显示输出字符(串)

⌨️ 快捷键说明

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