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

📄 target.c

📁 RTOS版本:uCOSII V2.83 OSView版本:uCOS_View 1.10 开发环境:KEIL 编译器:ADS1.2 开发板:EasyARM2200 内部FLASH运行
💻 C
📖 第 1 页 / 共 2 页
字号:
/****************************************Copyright (c)**************************************************
**                               Guangzou ZLG-MCU Development Co.,LTD.
**                                      graduate school
**                                 http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name:			target.c
** Last modified Date:	2004-09-17
** Last Version:		1.0
** Descriptions:		header file of the specific codes for LPC2200 target boards
**						Every project should include a copy of this file, user may modify it as needed
**------------------------------------------------------------------------------------------------------
** Created by:			Chenmingji
** Created date:		2004-02-02
** Version:				1.0
** Descriptions:		The original version
**
**------------------------------------------------------------------------------------------------------
** Modified by:			Chenmingji
** Modified date:		2004-09-17
** Version:				1.01
** Descriptions:		Renewed the template, added more compiler supports 
**
**------------------------------------------------------------------------------------------------------
** Modified by: 
** Modified date:
** Version:	
** Descriptions: 
**
********************************************************************************************************/

#define IN_TARGET
#include "config.h"

    extern void IRQ_Handler(void);
    extern void Timer0_Handler(void);
     
    extern void RS232_0_Handler(void);
    //extern void RS232_1_Handler(void);
    //extern void UART16554_Handler(void);
//-------------------------------------------------------------------------------------
/*
void InitUsbIrqVector(void)
{
        VICVectAddr1 = (uint32)ISP1160_Handler;	// 设置EINT0向量地址
        #if  EASYRAM2200_BOARD_EN == 1
    	VICVectCntl1 = (0x20 | 16);				// EINT0通道分配到IRQ slot 0,即优先级最高
    	VICIntEnable = (1<<16);					// 使能EINT0、EINT1中断
        #else
    	VICVectCntl1 = (0x20 | 14);
	    VICIntEnable = (1<<14);
        #endif 
}
*/
//-------------------------------------------------------------------------------------
/*********************************************************************************************************
** Function name:			IRQ_Exception
**
** Descriptions:			interrupt exceptional handler , change it as needed
**
** input parameters:		None
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			None
**
** Created by:				Chenmingji
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void IRQ_Exception(void)
{

    while(1);                   //  change it to your code 这一句替换为自己的代码
}

/*********************************************************************************************************
** Function name:			FIQ_Exception
**
** Descriptions:			Fast interrupt exceptional handler , change it as needed
**
** input parameters:		None
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			None
**
** Created by:				Chenmingji
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void FIQ_Exception(void)
{
    while(1);                   // change it to your code  这一句替换为自己的代码
}
/*********************************************************************************************************
** Function name:			Timer0_Exception
**
** Descriptions:			Timer0 interrupt service function
**
** input parameters:		None
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			None
**
** Created by:				Chenmingji
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
#if  0
INT32U      Tmr_ReloadCnts;            
void  Tmr_TickISR_Handler (void)
{
    T0IR        = 0xFF;                          /* Clear timer #0 interrupt                           */
                                                 /* Reload 'relative' to current interrupt time        */
#if BSP_DEBUG == 0
    T0MR0      += Tmr_ReloadCnts;
#endif
    VICVectAddr = 0;
    OSTimeTick();                                /* Call uC/OS-II's OSTimeTick()                       */
}
#else



#if OS_VIEW_MODULE > 0

#ifndef BSP_DEBUG
#define BSP_DEBUG 0
#endif

INT32U      Tmr_ReloadCnts;
#endif

void Timer0_Exception(void)
{
//-----------------------------------------------------
#if OS_VIEW_MODULE > 0
    T0IR        = 0xFF;                          /* Clear timer #0 interrupt                           */
#if BSP_DEBUG == 0
    T0MR0      += Tmr_ReloadCnts;
#endif     
//-----------------------------------------------------
#else    
//-----------------------------------------------------
    T0IR = 0x01;    
#endif    
//-----------------------------------------------------   
    VICVectAddr = 0;            //interrupt close 通知中断控制器中断结束
    OSTimeTick();
}
#endif

/*********************************************************************************************************
** Function name:			Timer0Init
**
** Descriptions:			Initialize the Time0
**
** input parameters:		None
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			None
**
** Created by:				Chenmingji
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void Timer0Init(void)
{
#if OS_VIEW_MODULE > 0    
    Tmr_ReloadCnts = (Fpclk / OS_TICKS_PER_SEC);
   // Tmr_ReloadCnts      = peripheral_clk_freq / OS_TICKS_PER_SEC;
    T0TCR               = 0;                     /* Disable timer 0.                                   */
    T0PC                = 0;                     /* Prescaler is set to no division.                   */
#if BSP_DEBUG == 0
    T0MR0               = T0TC + Tmr_ReloadCnts;
    T0MCR               = 1;                     /* Interrupt on MR0 (match register 0).               */
#else
    T0MR0               = Tmr_ReloadCnts;
    T0MCR               = 3;                     /* Interrupt on MR0 (reset TC)                        */
#endif
    T0CCR               = 0;                     /* Capture is disabled.                               */
    T0EMR               = 0;                     /* No external match output.                          */
    T0TCR               = 1;                     /* Enable timer 0                                     */    
#else
    T0IR = 0xffffffff;
    T0TC = 0;
    T0TCR = 0x01;
    T0MCR = 0x03;
    T0MR0 = (Fpclk / OS_TICKS_PER_SEC);
#endif
 }



/*********************************************************************************************************
** Function name:			TargetInit
**
** Descriptions:			Initialize the target board; it is called in a necessary place, change it as 
**							needed
**
** input parameters:		None
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			None
**
** Created by:				Chenmingji
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void TargetInit(void)
{
 
    OS_ENTER_CRITICAL();
    srand((uint32) TargetInit);
    
    BCFG0 = (0x01 << 28) | (0x05 << 11) | (0x01 << 10) | (0x04 << 5) | 0x1;  //0x10001460挂接norflash  0x1000ffef;
    BCFG1 = (0x01 << 28) | (0x01 << 11) | (0x01 << 10) |               0x1;  //0x10001460挂接ram
    BCFG2 = (0x01 << 28) | (0x04 << 11) | (0x01 << 10) | (0x04 << 5) | 0x2; //0x10001460挂接usb
    BCFG3 =                (0x04 << 11) | (0x01 << 10) | (0x04 << 5) | 0x1; //接16c2550和nandflash

    VICIntEnClr = 0xffffffff;
    VICDefVectAddr = (uint32)IRQ_Handler;
    
    VICVectAddr0 = (uint32)Timer0_Handler;
    VICVectCntl0 = (0x20 | 0x04);
    VICIntEnable = 1 << 0x04;
    Timer0Init();  
	OSView_Init();   
    OS_EXIT_CRITICAL();

    
    #if RS232_EN  == 1

    OS_ENTER_CRITICAL();
 	VICVectAddr5 = (uint32)RS232_0_Handler;     // UART0
 	VICVectCntl5 = (0x20 | 0x06);
 	VICIntEnable = (1 << 0x06);     

    OS_EXIT_CRITICAL();
 	#endif       		
 		                 

⌨️ 快捷键说明

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