⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 init.c

📁 《OSEK/VDX汽车电子嵌入式软件编程技术》中光盘的资料
💻 C
字号:
/************************************************
*
*	$Copyright    2001 Joseph J. Lemieux  ALL RIGHTS RESERVED. $
*
*	$Filename: C:\OSEKBook\src\CH02\src\init.c $
*
*   Description:  System Initialization Module
*                 This module provides the interfaces
*                 that may be used by the system to 
*                 initialize either 16 or 32 bit
*                 memory mapped registers, and to
*                 initialize the system based upon the 
*                 type of change.
*
************************************************/
#ifndef INITC
#define INITC

/************************************************
*
*   Include files
*
************************************************/

#include "typedefs.h"
#include "init.h"

/************************************************
*
*   Local macros
*
************************************************/

/************************************************
*
*   Local Function Prototypes
*
************************************************/

/************************************************
*
*   Local Variables
*
************************************************/

/************************************************
*
*   Local Constants
*
************************************************/

/************************************************
*
*   Functions
*
************************************************/
/************************************************
*
*   Function:     InitReg16
*
*   Inputs:       list - pointer to the null terminated list of 
*                 register:value pairs.
*
*   Outputs:      All registers in list are set to value.
*
*   Returns:      None.
*
*   Description:  This routine navigates a list of 16 bit
*                 registers and set them to a default value.
*                 Terminates when it hits a NULL pointer.
*
************************************************/
void InitReg16(InitReg16ListType const *list)
{
   while(list->reg != NULL)
   {
      *list->reg = list->value;
      list++;
   }
}

/************************************************
*
*   Function:     InitReg32
*
*   Inputs:       list - pointer to the null terminated list of 
*                 register:value pairs.
*
*   Outputs:      All registers in list are set to value.
*
*   Returns:      None.
*
*   Description:  This routine navigates a list of 32 bit
*                 registers and set them to a default value.
*                 Terminates when it hits a NULL pointer.
*
************************************************/
void InitReg32(InitReg32ListType const *list)
{
   while(list->reg != NULL)
   {
      *list->reg = list->value;
      list++;
   }
}

/************************************************
*
*   Function:     InitSystem
*
*   Inputs:       type - type of initialization occurring.
*
*   Outputs:      none
*
*   Returns:      none
*
*   Description:  Calls all functions in the list to initialize
*                 the application. Terminates when it hits a NULL 
*                 pointer.
*
************************************************/
void InitSystem(InitType type)
{
/*****
*
*   List to be navigated is always InitFunctionList, which
*   is defined in init.cfg.
*
*****/
   InitFunctionListType const *list = InitFunctionList;
	
   while(list->initfunction != NULL)
   {
      list->initfunction(type);
      list++;
   }
}

#endif /*INITC */

⌨️ 快捷键说明

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