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

📄 init.c

📁 不包含识别算法
💻 C
字号:
/*********************************************************************
 *
 * Copyright:
 *	MOTOROLA, INC. All Rights Reserved.  
 *  You are hereby granted a copyright license to use, modify, and
 *  distribute the SOFTWARE so long as this entire notice is
 *  retained without alteration in any modified and/or redistributed
 *  versions, and that such modified versions are clearly identified
 *  as such. No licenses are granted by implication, estoppel or
 *  otherwise under any patents or trademarks of Motorola, Inc. This 
 *  software is provided on an "AS IS" basis and without warranty.
 *
 *  To the maximum extent permitted by applicable law, MOTOROLA 
 *  DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, INCLUDING 
 *  IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
 *  PURPOSE AND ANY WARRANTY AGAINST INFRINGEMENT WITH REGARD TO THE 
 *  SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF) AND ANY 
 *  ACCOMPANYING WRITTEN MATERIALS.
 * 
 *  To the maximum extent permitted by applicable law, IN NO EVENT
 *  SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING 
 *  WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS 
 *  INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY
 *  LOSS) ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.   
 * 
 *  Motorola assumes no responsibility for the maintenance and support
 *  of this software
 ********************************************************************/
 
 
 /*
 * File:	init.c
 *
 * Purpose:	initialisation routines, such as CPU, Timer0 delay
 *		function and interrupt service routines.
 *
 * Notes:
 *
 * Modifications:
 *
 */

#define _INIT_H

#include <mcf5249.h>
#include <init.h>
#include <displays.h>

/********************************************************************/

/*--- 5us delay routine using Timer0 ---*/
void delay (uint32 delay)
{
	uint32 tester = 0;

	MCF5249_SIM_ICR1 = 0x84;		// set Timer0 to Interrupt level 1 and priority 0
	MCF5249_SIM_IMR  = 0xFFFFFDFF;		// enable timer0 interrupts

/*--- Setup timer for a 5us count ---*/
	MCF5249_TIMER0_TMR = 0x001D;		// master clock /16, prescale 1, interrupt on TRR, enable timer
	MCF5249_TIMER0_TRR = 0x0016;		// timer reference value (22 = 0x16)

	delayTick = 0;

	while(delayTick<delay)
		tester = (delay - delayTick);

	MCF5249_TIMER0_TMR = 0;			//reset timer
}

/*--- CPU module initialisation ---*/
void CPUInit(void)
{
	/*--- QSPI registers ---*/
	MCF5249_PLL_PLLCR |= 0x00000800;	//Sets the pin function to QSPI_CLK
	MCF5249_SIM_GPIO_FUNC &= ~0x25000000;	//Sets the pin function to QSPI_Dout, QSPI_CS0 and QSPI_CS1

	/*--- Setup the MCF5249 port pins for the LCD interface ---*/
	MCF5249_SIM_GPIO1_FUNC |= 0x00000020;	//Sets the pin function to output used for the LCD reset
	MCF5249_SIM_GPIO1_OUT &= ~0x00000020;	//Holds the LCD module in reset
	MCF5249_SIM_GPIO1_ENABLE |= 0x00000020;	//Enables the output
	MCF5249_QSPI_QMR = 0xC302;		// MSTR, DOHIE, DIVIDE BY 2

	/*--- Chip select registers ---*/
	MCF5249_CS_CSAR3 = 0x5000;		//Base address of memory mapped to CS3
	MCF5249_CS_CSMR3 = 0x00000001;		//Mask for CS3 address decode plus valid bit
	MCF5249_CS_CSCR3 = 0x00000941;		//2 wait states, internal TA, 8-bit port and valid bit
	MCF5249_IDE_CONFIG1 = 0x00040000;	//BUFENB1 active on CS3 (SRE/SWE cycles)
	MCF5249_IDE_CONFIG2 = 0x00010000;	//TA generation on CS3

	/*--- Sensor Bus Signals -WR -RD -CS0 setup ---*/
	MCF5249_SIM_GPIO_FUNC &= ~0x00000800;		//Sets the pin function to -SRE
	MCF5249_SIM_GPIO_FUNC &= ~0x00001000;		//Sets the pin function to -SWE
	MCF5249_SIM_GPIO1_FUNC &= ~0x02000000;		//Sets the pin function to -BUFENB1

	/*--- Enrollment/Verification switch setup ---*/
	MCF5249_SIM_GPIO1_FUNC |= 0x00100000;		//Sets the pin function to GPIO52
	MCF5249_SIM_GPIO1_ENABLE &= ~0x00100000;	//Sets the GPIO to input
}

//#pragma interrupt Timer0
/**********************************************************
 * Timer0 ISR                                             *
 **********************************************************/
void Timer0(void)
{
	MCF5249_TIMER0_TER = 0xFF; // reset timer interrupt event

	delayTick++;
}

⌨️ 快捷键说明

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