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

📄 uhal.c

📁 ucosIItest1添加信号).rar 初学者交流
💻 C
字号:
#include <stdarg.h>
#include <string.h>
#include <stdio.h>


#include "2410addr.h"
#include "2410lib.h"
//#include "uhal.h"
#include "Def.h"
#include "includes.h"

//Define version of uC/OS Hardware Associated Layer code.
#define VERSION_STRING	"Version 1.00"
#define AUTHOR_STRING      "hh"
#define BUILD_DATE      "2007.6.25"

void InitInfo(void)
{
 	Uart_Printf("\nSAMSUNG board\n");
    Uart_Printf(VERSION_STRING); 
    Uart_Printf("\n");
    Uart_Printf(AUTHOR_STRING);
    Uart_Printf("\n");
    Uart_Printf(BUILD_DATE);
    Uart_Printf("\n");
}

//InitTimers
void InitTimers(void)
{
	rTCFG0= 0x00000000;              	// prescaler0 = 0
	rTCFG1= 0x00000000;              	// mux0 = 1/2   
//timetick is 1000,	FCLK=200MHZ   
	rTCNTB0= PCLK/OS_TICKS_PER_SEC/2; //tick=1000;
	rTCMPB0= 0x0;
	rTCON=0x2;		//update mode for TCNTB0 and TCMPB0.
	rTCON=0x9;		//timer0 = auto reload, start	
}


void do_irq(void)
{
	rSRCPND &= BIT_TIMER0;
    rINTPND |= BIT_TIMER0;
    OSTimeTick();
}

void do_key1(void)
{
	rSRCPND &= BIT_EINT1;
    rINTPND |= BIT_EINT1;
    Uart_Printf("Key1 Input\n");
}
void InitInterrupts(void)
{
	rINTMOD     = 0x0;                     //All=IRQ mode
	rINTMSK     = BIT_ALLMSK;              //All interrupt is masked.
}

void InstallIrqHandler(void)
{
	pISR_TIMER0 = (unsigned) UCOS_IRQHandler;
}

void OpenIRQ(void)
{
   rINTPND=0x00000000;
   rINTMSK&=(~(BIT_TIMER0 ));	//Default value=0x7ffffff
   rINTMSK&=(~(BIT_EINT1 ));	//Default value=0x7ffffff
}

⌨️ 快捷键说明

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