?? target.c
字號:
/****************************************Copyright (c)****************************************************
** Guangzhou ZHIYUAN electronics Co.,LTD.
**
** http://www.embedtools.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"
/*********************************************************************************************************
** Function name: Timer0_Exception
**
** Descriptions: Timer0 interrupt service function
**
** input parameters: None
** output parameters: None
** Returned value: None
**
** Created by: Chenmingji
** Created Date: 2004/02/02
**--------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
void Timer0_Exception (void)
{
T0IR = 0x01;
VICVectAddr = 0; /* 通知中斷控制器中斷結束 */
OSTimeTick();
}
/*********************************************************************************************************
** Function name: Timer0Init
**
** Descriptions: Initialize the Time0
**
** input parameters: None
** output parameters: None
** Returned value: None
**
** Created by: Chenmingji
** Created Date: 2004/02/02
**--------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
void Timer0Init (void)
{
T0IR = 0xffffffff;
T0TCR = 0x03;
T0TC = 0;
T0MCR = 0x03;
T0MR0 = (Fpclk / OS_TICKS_PER_SEC);
T0TCR = 0x01;
vicIrqFuncSet(4, 0, (INT32U)Timer0_Exception);
}
/*********************************************************************************************************
** Function name: TargetInit
**
** Descriptions: Initialize the target board; it is called in a necessary place, change it as
** needed
**
** input parameters: None
** output parameters: None
** Returned value: None
**
** Created by: Chenmingji
** Created Date: 2004/02/02
**--------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
void TargetInit (void)
{
OS_ENTER_CRITICAL();
srand((INT32U) TargetInit);
Timer0Init();
OS_EXIT_CRITICAL();
}
/*********************************************************************************************************
** Function name: TargetResetInit
** Descriptions: Initialize the target
** input parameters: None
** output parameters: None
** Returned value: None
** Created by: Chenmingji
** Created Date: 2004/02/02
**--------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
void TargetResetInit (void)
{
#ifdef __IN_CHIP
MEMMAP = 0x1;
#endif
#ifdef __IN_RAM
MEMMAP = 0x2;
#endif
PLLCON = 1;
#if (Fpclk / (Fcclk / 4)) == 1
VPBDIV = 0;
#endif
#if (Fpclk / (Fcclk / 4)) == 2
VPBDIV = 2;
#endif
#if (Fpclk / (Fcclk / 4)) == 4
VPBDIV = 1;
#endif
#if (Fcco / Fcclk) == 2
PLLCFG = ((Fcclk / Fosc) - 1) | (0 << 5);
#endif
#if (Fcco / Fcclk) == 4
PLLCFG = ((Fcclk / Fosc) - 1) | (1 << 5);
#endif
#if (Fcco / Fcclk) == 8
PLLCFG = ((Fcclk / Fosc) - 1) | (2 << 5);
#endif
#if (Fcco / Fcclk) == 16
PLLCFG = ((Fcclk / Fosc) - 1) | (3 << 5);
#endif
PLLFEED = 0xaa;
PLLFEED = 0x55;
while((PLLSTAT & (1 << 10)) == 0);
PLLCON = 3;
PLLFEED = 0xaa;
PLLFEED = 0x55;
MAMCR = 0; /* 設置存儲器加速模塊 */
#if Fcclk < 20000000
MAMTIM = 1;
#else
#if Fcclk < 40000000
MAMTIM = 2;
#else
MAMTIM = 3;
#endif
#endif
MAMCR = 2;
}
/*********************************************************************************************************
以下為一些與系統相關的庫函數的實現
具體作用請ads的參考編譯器與庫函數手冊
用戶可以根據自己的要求修改
*********************************************************************************************************/
/*********************************************************************************************************
The implementations for some library functions
For more details, please refer to the ADS compiler handbook and The library
function manual
User could change it as needed
*********************************************************************************************************/
#pragma import(__use_no_semihosting_swi)
#pragma import(__use_two_region_memory)
void _ttywrch (int ch)
{
ch = ch;
}
/*********************************************************************************************************
End File
*********************************************************************************************************/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -