📄 firminit.c
字号:
/**************************************************************************
* *
* PROJECT : ARM port for UCOS-II *
* *
* MODULE : FRMWRK.c *
* *
* AUTHOR : Michael Anburaj *
* URL : http://geocities.com/michaelanburaj/ *
* EMAIL: michaelanburaj@hotmail.com *
* *
* PROCESSOR : S3c2410x (32 bit ARM920T RISC core from Samsung) *
* *
* IDE : SDT 2.51 & ADS 1.2 *
* *
* DESCRIPTION : *
* This is the Framework module. Creates an operating infrastructure. *
* *
**************************************************************************/
#include "includes.h"
#include <stdarg.h>
#include <stdio.h>
/* declaration for local function */
void init_PMU(void);
void init_timer(void);
/* ********************************************************************* */
/* Global definitions */
void FirmInit(void)
{
#ifndef ARMulator
init_PMU();
mask_all_irq();
enable_all_irq();
#endif
//init_timer();
}
/* ********************************************************************* */
/* Global definitions */
void init_PMU(void)
{
U32 sysclk;
U32 i,n,m;
sysclk =70000000; //config sysclk
//****************************open all module
*(RP)(PMU_PSCR) =0x17fff; //open all module
*(RP)(PMU_PMDR) =0X01;
*(RP)PMU_PLTR=0x00d200cd; //MLTV=210,ULTV=205
for(i=0;i<100;i++);
n = 2;
m = 8*sysclk/10000000;
*(RP)(PMU_PMCR) = (n << 8) | m;
*(RP)(PMU_PMCR) = (1 << 12) | (n << 8) | m;
*(RP)PMU_PUCR=0x1530; //parameter PD=5,D=48
}
void init_timer( void )
{
#ifdef ARMulator
*(RP)GPT1_LCR = 0x7A1; //10ms under 50MHz
*(RP)GPT1_CR = 0xC8; //enable period work under 256 divied frequency
#else
#ifdef GIII
*(RP)GPT1_CNTL = 0X007; //0-select gpt
//;0-disable software reset
//;0-restar mode
//;11-cancel catch the rising edge and falling edge and send a int signal function
//;0-comparament irq disable
//;01-sysclk/16 to prescaler
//;1-gpt disable
*(RP)GPT1_SCAL = 0X07; //set prescaler regment
*(RP)GPT1_COMP = 0X186a0; ////set count value,10ms ,70MHZ
*(RP)GPT1_CNTL = 0X17; //interrupt enable
#else //GIV
*(RP)GPT1_LCR = 0xAAE60; //10ms under 70MHz
*(RP)GPT1_CR = 0x03; //normal work and interrupt enable
#endif
#endif
unmask_irq(INT_GPT);
return;
}
/* ********************************************************************* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -