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

📄 systeminit.c

📁 NEC 的无线通讯方案
💻 C
字号:
/*
* $Id: systeminit.c,v 1.12 2007/10/30 06:17:16 sunny Exp $
*/
/*
*******************************************************************************
**
**  This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
**  78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
**
**  Copyright(C) NEC Electronics Corporation 2002 - 2005
**  All rights reserved by NEC Electronics Corporation.
**
**  This program should be used on your own responsibility.
**  NEC Electronics Corporation assumes no responsibility for any losses
**  incurred by customers or third parties arising from the use of this file.
**
**  Filename :	systeminit.c
**  Abstract :	This file implements macro initialization.
**  APIlib :	NEC78K0KX2.lib V1.01 [09 Aug. 2005]
**
**  Device :	uPD78F0537
**
**  Compiler :	NEC/CC78K0
**
*******************************************************************************
*/
/*
*******************************************************************************
**  Include files
*******************************************************************************
*/
#include "unet.h"
#include "system.h"
#include "int.h"
#include "port.h"
#include "timer.h"
#include "watchtimer.h"
#include "serial.h"
#include "lvi.h"

size_t init_malloc_vars(void);

/*
*******************************************************************************
**  MacroDefine
*******************************************************************************
*/
#if 0
void SystemReset(void)
{
	TRACE_puts("SystemReset");

#if defined(__K0__)
    {
	void (**reset)(void) = 0;	// 2007/6/21 15:25, Sunny: jump to the address specified by reset vector
	(*reset)();
    }
#else
        #error "Unknown Compiler."
#endif
}
#endif

/*
**-----------------------------------------------------------------------------
**
**  Abstract:
**	Init every Macro
**
**  Parameters:
**	None
**
**  Returns:
**	None
**
**-----------------------------------------------------------------------------
*/
void SystemInit( void )
{
	init_malloc_vars( );

	/* Clock generator initiate */
	Clock_Init();
	/* Port initiate */
	PORT_Init();
	/* INT initiate */
	INT_Init();
	/* WT initiate */
	WT_Init();

#if ENABLE_UART0
	/* UART0 initiate */
	UART0_Init();
#endif // ENABLE_UART0

#if ENABLE_UART6
	/* UART6 initiate */
	UART6_Init();
#endif // #if ENABLE_UART6

#if ENABLE_CSI10
	/* CSI10 initiate */
	CSI10_Init();
#endif // ENABLE_CSI10

#if ENABLE_CSI11
	/* CSI11 initiate */
	CSI11_Init();
#endif // #if ENABLE_CSI11

	/* TMH0 initiate */
	TMH0_Init();
	/* LVI initiate */
	LVI_Init();
}

/*
**-----------------------------------------------------------------------------
**
**  Abstract:
**	Init hardware setting
**
**  Parameters:
**	None
**
**  Returns:
**	None
**
**-----------------------------------------------------------------------------
*/
void hdwinit( void )
{
	UINT16 delay;


	DI( );
	for(delay = -1; delay; --delay);     // 2007/3/8 20:57:48, Sunny: system power-up (RESET) delay for stability
	IMS = MEMORY_IMS_SET;
	IXS = MEMORY_IXS_SET;
//	SystemInit( );  // move to main()
//	EI( );          // enable interrupt in main() when everything is ready
}

⌨️ 快捷键说明

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