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

📄 uhal.c

📁 ucos ii串口通讯程序
💻 C
字号:
/***************************************************************************\
	Copyright (c) 2004-2007 threewater@up-tech.com, All rights reserved.
	by threewter	2004.5.12
\***************************************************************************/
/***************************************************************************\
    #说明: C  main 函数,ucos-ii初始化等定义
	----------------------------------  Bug  --------------------------------------

	----------------------------------  TODO list  --------------------------------------

	----------------------------------修正--------------------------------------

	2004-5-12	移植

\***************************************************************************/

#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>

#include "../ucos-ii/includes.h"
#include "../inc/sys/lib.h"
#include "../inc/marco.h"
#include "../inc/drv/register.h"
#include "uhal.h"
#include "isr.h"


#define _TICK		OS_TICKS_PER_SEC
#define _TIMERCLK	Fpclk
#define TIMER_COUNT		((_TIMERCLK)/(_TICK))

//Initialize timer that is used OS.
void uHALr_InitTimers(void)//use timer1
{
	//the following code is for lpc2xxx, use timer0 for tick
	T0IR = 0xffffffff;	//reset ir
	T0TC = 0;
	T0TCR = 0x0;		//disable timer count
	T0MCR = 0x03;	//
	T0MR0 = TIMER_COUNT;
	T0TCR = 0x01;	//enable timer count
}//uHALr_InitTimers

void TimerTickHandle(int vector, void* data)
{
	T0IR = 0x01;	//clear T0IR
	OSTimeTick();
}

//Start system timer & enable the interrupt.
void uHALr_InstallSystemTimer(void)
{
	SetISR_Interrupt(TIMER0_OFFSET, TimerTickHandle, NULL);
}//uHALr_InstallSystemTimer

void BreakPoint(void)
{
	printf("!!!Enter break point.\n");

	for(;;);
}//BreakPoint

void OutDebug(unsigned int num)
{
	printf("\n***STACK***:%d\r\n", num);
}//OutDebug

//Define pre & post-process routines for Interrupt.
void uHALir_DefineIRQ(void *is, void *iq, void *n)
{
}//uHALir_DefineIRQ

static int I_COUNT=0;

void Enter_UNDEF(void)
{
	printf("!!!Enter UNDEFINED. %d\r\n", I_COUNT++);

	for(;;);
}//BreakPoint


void Enter_SWI(void)
{
	printf("!!!Enter SWI. %d\r\n", I_COUNT++);	

	for(;;);
}

void Enter_PABORT(void)
{
	printf("!!!Enter Prefetch ABORT %d\r\n", I_COUNT++);

	for(;;);
}

void Enter_DABORT(void)
{
	printf("!!!Enter Data ABORT %d\r\n", I_COUNT++);

	for(;;);
}

void Enter_FIQ(void)
{
	printf("!!!Enter FIQ. %d\r\n", I_COUNT++);

	for(;;);
}

void ARMTargetInit(void)
{

/////////////////////////////////////////////////////////////////
		Port_Init();

		Uart_Init(0,115200);
		Uart_Init(1,115200);

		udelay(0);	//计算延时循环
		//init_SIO();
		//NandFlash_init();

		uHALr_InitInterrupts();
		uHALr_InitTimers();
/////////////////////////////////////////////////////////////////

}


⌨️ 快捷键说明

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