idle.c

来自「在blankfin中 实现src 的程序」· C语言 代码 · 共 62 行

C
62
字号
/* Copyright (C) 2001 Analog Devices Inc., All Rights Reserved.
** This contains Analog Devices Background IP and Development IP as
** defined in the ADI/Intel Collaboration Agreement.
** ADI/Intel Confidential.
*/
/* Variants of _halt() and _abort() that enter the idle state, and never
** leave. They do write a nice message beforehand, though.
** Intended for use on programs that are linked for running on the visual
** simulator (the default).
*/
#include <device.h>

#include <pcio.h>
extern int __default_io_device;
extern PciIoCB pci[1];

#define MSG	"Idling...\n"
#define MSGLEN	11
static const char msg[MSGLEN] = MSG;
extern int _Write(int, const char *, int);

#pragma retain_name
void _halt_processor(void)
{
	if (__default_io_device == PCI_IO)
	{
		pci->cmd = DSP_EXIT_REQUEST;
		_PciIO();
		asm("p0.h = 0xffc0;");
		asm("p0.l = 0x3800;");
		asm("p1.h = 0xffc0;");
		asm("p1.l = 0x3900;");
		asm("r0 = 0;");
		asm("w[p0 + 2] = r0;");
		asm("ssync;");
		asm("w[p1 + 2] = r0;");
		asm("ssync;");
		asm("nop;");
		asm("nop;");
		asm("nop;");
		asm("nop;");
		asm("nop;");
		asm("raise 1;");
	}

  _Write(2, msg, MSGLEN);
  for (;;) {
    asm("IDLE;\n");
  }
  /* NOTREACHED */
}

#pragma retain_name
void _abort_processor(void)
{
  _Write(2, msg, MSGLEN);
  for (;;) {
    asm("IDLE;\n");
  }
  /* NOTREACHED */
}

⌨️ 快捷键说明

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