📄 main.c
字号:
/************************************************
*
* $Copyright 2001 Joseph J. Lemieux ALL RIGHTS RESERVED. $
*
* $Filename: C:\OSEKBook\src\CH01\src\main.c $
*
* Description: Main application routines.
* This module provides the main()
* entry point that starts the OS
* and allows application mode
* switching.
*
************************************************/
#ifndef MAINC
#define MAINC
#include "typedefs.h"
#include "os.h"
#include "main.h"
#include "init.h"
/************************************************
*
* Function: main
*
* Inputs: argc - application specific value
* passed by startup code.
*
* Outputs: none
*
* Returns: void
*
* Description: Application specific startup code.
* Initializes the application and then
* start the operating system.
*
************************************************/
void main(long argc)
{
/*****
*
* Initialize the 16 and 32 bit registers. The lists
* are defined in init.cfg.
*
*****/
InitReg16(InitHardwareRegs16);
InitReg32(InitHardwareRegs32);
/*****
*
* Initialize the application based upon a reset. It is
* up to the individual functions to take action based upon
* a reset.
*
*****/
InitSystem(INIT_RESET);
/*****
*
* Start the operating system within an infinite loop. Since
* the OSEK/VDX operating system can be started and stopped,
* this routine restarts the OS after shutdown.
*
*****/
while(1)
{
StartOS(SINGLE_PLAYER);
}
}
/************************************************
*
* Function: ChangeMode
*
* Inputs: mode - mode that is being requested.
*
* Outputs: none
*
* Returns: If mode cannot be switched, returns
* ERROR_INVALID_MODE.
*
* Description: If the mode is valid, shuts down the OS
* and never returns. Otherwise, returns an
* error.
*
************************************************/
ApplicationErrorType ChangeMode(AppModeType mode)
{
/*****
*
* Check for a valid mode and switch if valid.
*
*****/
if((mode == SINGLE_PLAYER))
{
ShutdownOS(E_OK);
}
/*****
*
* If not valid, return an error.
*
*****/
return ERROR_INVALID_MODE;
}
/************************************************
*
* Task: background
*
* Description: Dummy task that is required to get
* the system started.
*
************************************************/
TASK(background)
{
TerminateTask();
}
#endif /* MAINC */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -