📄 init.cfg
字号:
/************************************************
*
* $Copyright 2001 Joseph J. Lemieux ALL RIGHTS RESERVED. $
*
* $Filename: C:\OSEKBook\src\CH12\cfg\init.cfg $
*
* Description: This file defines the lists of register and function
* initializers to be used in the application.
* three lists are automatically used as follows:
* InitResetRegs16 - 16 bit registers initialized
* after reset.
* InitResetRegs32 - 32 bit registers initialized
* after reset.
* InitFunctionList - List of functions to be invoked
* each time InitSystem is called.
* Fill in for each application.
*
************************************************/
#ifndef INITCFG
#define INITCFG
/***
*
* Include header files defining registers and functions
*
***/
#include "register.h"
#include "os.h"
#include "dispdrv.h"
#include "shuffle.h"
#include "keypad.h"
#include "cardgame.h"
/************************************************
*
* Define lists of 16 bit registers for future
* initialization. Each list is passed to the
* interface InitReg16, which then sets the
* registers to the values
*
* The macros used to define each list are as
* below. They must appear in the following
* order:
*
* START_INIT_REG16_LIST(name,size)
* Start list of registers to be initialized.
* Only one allowed. size is number of add entries
* following.
* ADD_INIT_REG16_LIST(reg,value)
* register is the name of the PPC register as
* defined in registers.h.
* value is the 16 bit value that is written
* to the register.
* As many as required are included.
* END_INIT_REG16_LIST
* End the list. Only one appears for each list.
*
************************************************/
START_INIT_REG16_LIST(InitResetRegs16,2)
ADD_INIT_REG16_LIST(&usiuReg.rtcsc,0x0080)
ADD_INIT_REG16_LIST(&usiuReg.piscr,0x0000)
END_INIT_REG16_LIST
START_INIT_REG16_LIST(InitHardwareRegs16,8)
ADD_INIT_REG16_LIST(&mios1Cntl.mcpsmscr,0x8000)
ADD_INIT_REG16_LIST(&mios1Int.mios1er0,0x1000)
ADD_INIT_REG16_LIST(&mios1Reg.mmcsm6ml,0x0000)
ADD_INIT_REG16_LIST(&mios1Reg.mmcsm6scr,0x06FF)
ADD_INIT_REG16_LIST(&mios1Reg.mdasm11ar,0x0000)
ADD_INIT_REG16_LIST(&mios1Reg.mdasm11br,0x8000)
ADD_INIT_REG16_LIST(&mios1Reg.mdasm11scr,0x2008)
ADD_INIT_REG16_LIST(&mios1Reg.mdasm12scr,0x2003)
END_INIT_REG16_LIST
/************************************************
*
* Define lists of 32 bit registers for future
* initialization. Each list is passed to the
* interface InitReg32, which then sets the
* registers to the values
*
* The macros used to define each list are as
* below. They must appear in the following
* order:
*
* START_INIT_REG32_LIST(name,size)
* Start list of registers to be initialized.
* Only one allowed. size is number of add entries
* following.
* ADD_INIT_REG32_LIST(register,value)
* register is the name of the PPC register as
* defined in registers.h.
* value is the 32 bit value that is written
* to the register.
* As many as required are included.
* END_INIT_REG32_LIST
* End the list. Only one appears for each list.
*
************************************************/
START_INIT_REG32_LIST(InitResetRegs32,9)
ADD_INIT_REG32_LIST(&usiuReg.siumcr,0x00410000)
ADD_INIT_REG32_LIST(&usiuReg.sypcr,0xFFFFFF88)
ADD_INIT_REG32_LIST(&usiuReg.rtcsck,0x55CCAA33)
ADD_INIT_REG32_LIST(&usiuReg.rtck,0x55CCAA33)
ADD_INIT_REG32_LIST(&usiuReg.rtseck,0x55CCAA33)
ADD_INIT_REG32_LIST(&usiuReg.rtcalk,0x55CCAA33)
ADD_INIT_REG32_LIST(&usiuReg.sccr,0x00000200)
ADD_INIT_REG32_LIST(&usiuReg.simask,0x00000000)
ADD_INIT_REG32_LIST(&usiuReg.sipend,0x00000000)
END_INIT_REG32_LIST
START_INIT_REG32_LIST(InitHardwareRegs32,0)
END_INIT_REG32_LIST
/************************************************
*
* Define list of initialization functions for the
* application. Each function is executed each time
* the InitSystem function is called.
*
* The macros used to define each list are as
* below. They must appear in the following
* order:
*
* START_INIT_FUNCTION_LIST(name,size)
* Start list of registers to be initialized.
* Only one allowed. size is number of add entries
* following.
* ADD_INIT_FUNCTION_LIST(register,value)
* register is the name of the PPC register as
* defined in registers.h.
* value is the 32 bit value that is written
* to the register.
* As many as required are included.
* END_INIT_FUNCTION_LIST
* End the list. Only one appears for each list.
*
************************************************/
void OSInit(InitType type);
START_INIT_FUNCTION_LIST(InitFunctionList,5)
ADD_INIT_FUNCTION_LIST(InitDisplay)
ADD_INIT_FUNCTION_LIST(OSInit)
ADD_INIT_FUNCTION_LIST(InitShuffleSwitch)
ADD_INIT_FUNCTION_LIST(InitKeypad)
ADD_INIT_FUNCTION_LIST(InitGame)
END_INIT_FUNCTION_LIST
/************************************************
*
* Define list of autostarted alarms for the
* application. Each alarm is started whenever the
* application mode defined by the mask is invoked.
* The application mode mask is defined in os.cfg
* and has the format <appmodename>_MASK.
*
* The macros used to define each list are as
* below. They must appear in the following
* order:
*
* START_ALARM_AUTOSTART_LIST(name,size)
* Start list of alarms to be autostarted. name
* will always be AlarmAutostartList. size is number
* of add entries following.
* ADD_ALARM_AUTOSTART_LIST(alarm,alarmtype,start,cycle,appmodemask)
* alarm is the alarm name from the OIL file
* alarmtype is either ALARM_REL or ALARM_ABS.
* start is the value in counter ticks at which the alarm is to trigger
* cycle is the periodicity of the alarm - 0 means one shot
* appmodemask is the logical orring of application modes in which the
* alarm is to be started. set to ALARM_ALL_MODES to start in
* all modes.
* As many as required are included.
* END_ALARM_AUTOSTART_LIST
* End the list. Only one appears for each list.
*
************************************************/
START_ALARM_AUTOSTART_LIST(AlarmAutostartList,2)
ADD_ALARM_AUTOSTART_LIST(SampleKeypadAlarm,ALARM_REL,500,10,ALARM_ALL_MODES)
ADD_ALARM_AUTOSTART_LIST(MonitorNetworkAlarm,ALARM_REL,500,10,ALARM_ALL_MODES)
END_ALARM_AUTOSTART_LIST
#endif /* INITCFG */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -