当前位置: 代码迷 >> VxWorks >> vxWorks应用程序怎么能让系统重启
  详细解决方案

vxWorks应用程序怎么能让系统重启

热度:1441   发布时间:2013-02-26 00:00:00.0
求教:vxWorks应用程序如何能让系统重启?
vxWorks应用程序如何能让系统重启?

------解决方案--------------------------------------------------------
reboot函数。参见帮助。
------解决方案--------------------------------------------------------
直接写控制重启的那个寄存器。
------解决方案--------------------------------------------------------
没有重启是你的BSP没有支持。
------解决方案--------------------------------------------------------
嵌入式系统中一般都有硬件狗,有CPU狗也有外狗,确认一下它是如何设置的,如果已经使能了锁中断之后死循环
就可以复位,比调reboot要彻底一些。
------解决方案--------------------------------------------------------
STATUS sysToMonitor
(
int startType /* parameter passed to ROM to tell it how to boot */
)


就是它了~~reboot最后会调用到这个函数

其实应用程序可以使用的RESET要查找CPU的软硬中断资源的~~实在不行WDT超时不也重启了
------解决方案--------------------------------------------------------
roboot函数并不会充气系统,但会调用syslib.c中的sysToMonitor函数


/*******************************************************************************
*
* sysToMonitor - transfer control to the ROM monitor
*
* This routine transfers control to the ROM monitor. Normally, it is called
* only by reboot()--which services ^X--and by bus errors at interrupt level.
* However, in some circumstances, the user may wish to introduce a
* <startType> to enable special boot ROM facilities.
*
* The entry point for a warm boot is defined by the macro ROM_WARM_ADRS
* in config.h. We do an absolute jump to this address to enter the
* ROM code.
*
* RETURNS: Does not return.
*/

STATUS sysToMonitor
(
int startType /* parameter passed to ROM to tell it how to boot */
)
{
FUNCPTR pRom = (FUNCPTR) (ROM_WARM_ADRS);
int ix;

intLock (); /* disable interrupts */

cacheDisable (INSTRUCTION_CACHE); /* Disable the Instruction Cache */
cacheDisable (DATA_CACHE); /* Disable the Data Cache */

#if (CPU == PPC604)
vxHid0Set (vxHid0Get () & ~_PPC_HID0_SIED); /* Enable Serial Instr Exec */
#endif /* (CPU == PPC604) */
  
/* Turn off timer */

#ifdef INCLUDE_AUX_CLK
sysAuxClkDisable();
#endif

/* turn off all i8259 int's */

for (ix = 0; ix < WB_MAX_IRQS; ix++)
{
intDisable (ix + INT_NUM_IRQ0);
}

for (ix = 0; ix < EPIC_MAX_EXT_IRQS; ix++)
{
intDisable (ix);
}

sysEpicInit(EPIC_DIRECT_IRQ, (ULONG)0); /* reset the epic registers */

#if FALSE /* sandpoint errata: do not enable this until fixed in X3 rev */
{
UINT8 resetVal;

pciConfigInByte (WB_PCI_BUS, WB_PCI_DEV, WB_PCI_FUNC, 
WB_PCI_CLK_DIV_INDX, &resetVal);

pciConfigOutByte (WB_PCI_BUS, WB_PCI_DEV, WB_PCI_FUNC,
WB_PCI_CLK_DIV_INDX, (resetVal | WB_RSTDRV_BIT));

/* 50 ms delay to allow ISA & PCI RST to settle */
sysMsDelay (50);
}
#endif

vxMsrSet (0); /* Clear the MSR */

(*pRom) (startType); /* jump off to romInit.s */

return (OK); /* in case we continue from ROM monitor */
}

------解决方案--------------------------------------------------------
taskSpawn("rebooting", 10, 0, 1024, (FUNCPTR)reboot,
BOOT_QUICK_AUTOBOOT, 0, 0, 0, 0, 0, 0, 0, 0, 0);

------解决方案--------------------------------------------------------
(void(*)(void))reset_addr
其中reset_addr就是你的复位地址,根据你的CPU类型和你的BSP设置定
------解决方案--------------------------------------------------------
reboot让系统重新创建任务。
------解决方案--------------------------------------------------------
  相关解决方案