swi_handler_test.c

来自「一个简单的小型操作系统」· C语言 代码 · 共 90 行

C
90
字号

/*****************************************************************************
 *
 * Module       : handler.c
 * Description  : provides the SWI handlers
 * Originator   : Andrew N. Sloss
 * History      :
 *	
 * November 4th 2001 Andrew N. Sloss
 * - corrected the header
 *
 * January 3rd 2002 Andrew N. Sloss
 * - added the bringup swi for trace and fatal error
 *
 * April 30th 2002 Andrew N. Sloss
 * - cleaned up for Integrator port
 *
 *****************************************************************************/

/*****************************************************************************
 * IMPORT
 *****************************************************************************/

#include "../../core/all.h"

/*****************************************************************************
 * MACROS
 *****************************************************************************/

/* Mode control bits .......................... */

#define SYSTEM 0x1f
#define SVC    0x13
#define USER   0x10

/* IRQ control bits ........................... */

#define IRQoN  0x40
#define IRQoFF 0xc0

/* Low-level FIQ debug ........................ */

void  modifyControlCPSR(unsigned int);
void  bringUpSetR8fiq(unsigned int);
void  bringUpSetR9fiq(unsigned int);
void  bringUpSetR10fiq(unsigned int);

extern unsigned int STATE;

/*****************************************************************************
 * ROUTINES
 *****************************************************************************/

/* -- events_swi_e7t_handler --------------------------------------------------
 *
 * Descriptions : handler the swi calls for the e7t
 * 
 * Parameters   : int swi_number - swi being called
 *              : SwiRegs *r	 - pointer to the SWI registers
 * Return       : CallBack pointer
 * Other        :
 *
 * This function should migrate to be generic
 *
 */
#define TEST1 100

CallBack eventsSWIHandler(int swi_number, SwiRegs *r) 
{
  switch (swi_number) 
  {
  case /* SWI */ SLOS:
    switch (r->r[0])
    {
    /* Test Number: 100
     * Description: test basic swi call
     *
     */
    case TEST1: /* 100: this test basic functionality */
    r->r[0] = 0x1001;
    r->r[1] = 0x2002;
    r->r[2] = 0x3003;
    break;
    }
  break;
  }
return reportOK();
}

⌨️ 快捷键说明

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