📄 devinit.c
字号:
/* *---------------------------------------------------------------------- * T-Kernel * * Copyright (C) 2004-2006 by Ken Sakamura. All rights reserved. * T-Kernel is distributed under the T-License. *---------------------------------------------------------------------- * * Version: 1.02.02 * Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/9. * *---------------------------------------------------------------------- *//* * devinit.c (M32104) * Device-Dependent Initialization */#include "sysinit.h"#include "kernel.h"#include <sys/sysinfo.h>#include <sys/rominfo.h>#include <device/devconf.h>/* Saved data of system common information */EXPORT SysCommonInfo SaveSCInfo;/* * Display the progress of start processing * 0x10 - 0x1F : Initialization (before kernel starts) * 0x20 - 0x2F : Kernel start processing * 0x30 - 0x3F : Start processing (after kernel starts) */EXPORT void DispProgress( W n ){}/* ------------------------------------------------------------------------ *//* * Initialization before T-Kernel starts */EXPORT ER init_device( void ){IMPORT void CountWaitUsec( void ); /* cntwus.c */ W val[L_DEVCONF_VAL]; W n; /* Compute loop count of micro second wait */ CountWaitUsec(); /* Set SYSCONF/DEVCONF */ SCInfo.sysconf = ROMInfo->sysconf; SCInfo.devconf = ROMInfo->devconf; /* Set debug mode */ n = GetDevConf(DCTAG_DEBUGMODE, val); SCInfo.bm.c.debug = ( n >= 1 && val[0] > 0 )? 1: 0; /* Save system common information */ SaveSCInfo = SCInfo; return E_OK;}/* ------------------------------------------------------------------------ *//* * Start processing after T-Kernel starts * Called from the initial task contexts. */EXPORT ER start_device( void ){ return E_OK;}/* ------------------------------------------------------------------------ *//* * System finalization * Called just before system shutdown. * Execute finalization that must be done before system shutdown. */EXPORT ER finish_device( void ){ return E_OK;}/* ------------------------------------------------------------------------ *//* * Re-starting processing *//* * 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) */ /* Unsupported */ return E_NOSPT; } if ( mode == -2 ) { return E_NOSPT; /* Unsupported */ } if ( (mode & 0xff000000) == 0xff000000 ) { /* Re-start at specified time */ return E_NOSPT; /* Unsupported */ } return E_PAR;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -