/*
 * Re-starting processing
 *	mode = -1		Reset and re-start	(cold boot)
 *	mode = -2		Re-start		(warm boot)
 *	mode = -3		Reboot			(normal boot)
 *	mode = 0xFFhhmmss	Re-start at hh:mm:ss
 *				0 <= hh < 24, 0 <= mm,ss < 60
 */
EXPORT ER knl_restart_device( W mode )
{
	if ( mode == -1 ) {
		/* Reset and re-start (cold boot) */
#if USE_KERNEL_MESSAGE
		tm_putstring((UB*)"\n<< SYSTEM RESTART >>\n");
#endif
		tm_exit(-1);  /* no return */
		return E_OBJ;
	}

	if ( mode == -3 ) {
		/* Reboot (normal boot) */
#if USE_KERNEL_MESSAGE
		tm_putstring((UB*)"\n<< SYSTEM REBOOT >>\n");
#endif
		return E_NOSPT;
	}

	if ( mode == -2 ) {
		return E_NOSPT; /* Unsupported */
	}

	if ( (mode & 0xff000000U) == 0xff000000U ) {
		/* Re-start at specified time */
		return E_NOSPT;	/* Unsupported */
	}

	return E_PAR;
}
Example #2
0
/*
 * Re-starting processing
 *	mode = -1		Reset and re-start	(cold boot)
 *	mode = -2		Re-start		(warm boot)
 *	mode = -3		Reboot			(normal boot)
 *	mode = 0xFFhhmmss	Re-start at hh:mm:ss
 *				0 <= hh < 24, 0 <= mm,ss < 60
 */
EXPORT ER restart_device( W mode )
{
	if ( mode == -1 ) {
		/* Reset and re-start (cold boot) */
#if USE_KERNEL_MESSAGE
		tm_putstring((UB*)"\n<< SYSTEM RESTART >>\n");
#endif
		tm_exit(-1);  /* no return */
		return E_OBJ;
	}

	if ( mode == -3 ) {
		/* Reboot (normal boot) */
		static UB bdcmd[4 + L_DEVNM] = "bd ";
#if USE_KERNEL_MESSAGE
		tm_putstring((UB*)"\n<< SYSTEM REBOOT >>\n");
#endif
		strncat((char*)bdcmd, (char*)SCInfo.bootdev, L_DEVNM);
		tm_command(bdcmd);	/* Normally no return */
		return E_OBJ;		/* When the BD command is an error */
	}

	if ( mode == -2 ) {
		return E_NOSPT; /* Unsupported */
	}

	if ( (mode & 0xff000000) == 0xff000000 ) {
		/* Re-start at specified time */
		return E_NOSPT;	/* Unsupported */
	}

	return E_PAR;
}
Example #3
0
/*
 * Target system-dependent finalization
 *	Normally jump to ROM monitor.
 *	No return from this function.
 */
EXPORT void tkdev_exit( void )
{
	disint();
	tm_exit(0);	/* Turn off power and exit */

	/* Not suppose to return from 'tm_exit,' but just in case */
	for ( ;; ) {
		tm_monitor();  /* To T-Monitor */
	}
}
Example #4
0
File: main.c Project: chenws/codes
int main() 
{
	int i = 10;
	unsigned long id = 0;
#if LOG_MOD==LOG_MUL_THREAD
	thread_mgmt_t tm;
	logx_init("D:/abc.txt", LOG_MUL_THREAD);
	tm_init(&tm);
	tm_create_thread(tm,"t1",f_thread1);
	tm_create_thread(tm,"t2",f_thread2);
	tm_create_thread(tm,"t3",f_thread3);
#else
	logx_init("D:/abc.txt", LOG_SIG_THREAD);
#endif
    __assert(0);

	debugx(xinfo, "this is %s!\n", "xinfo");
	debugx(xdata, "this is %s!\n", "xdata");
	debugx(xentry, "this is %s!\n", "xentry");
	debugx(xevent, "this is %s!\n", "xevent");
	debugx(xmsg, "this is %s!\n", "xmsg");
	debugx(xwarn, "this is %s!\n", "xwarn");
	debugx(xerror, "this is %s!\n", "xerror");
	debugx(xfatal, "this is %s!\n", "xfatal");
	debugx(xerror, "this is %s!\n", "xerror");

	id = gettidx();

	while (i--)
	{
		debugx(xfatal, "thread id(%d): this is %s!\n", id, "xfatal");
		sleep(val_time);
	}

#if LOG_MOD==LOG_MUL_THREAD
	tm_exit(&tm);
#endif
	logx_exit();

	return 0;
}