📄 boot_ucos.c
字号:
/*********************************************************************************************
* File: boot_ucos.c
* Author: embest
* Desc:
* History:
*********************************************************************************************/
#include "44b.h"
#include "44blib.h"
void beep(int BeepStatus);
/*********************************************************************************************
* name: main
* func: c code entry
* para: none
* ret: none
* modify:
* comment:
*********************************************************************************************/
void Main(void)//int argc, char **argv
{
port_init();
beep(1);
delay(10000);
beep(0);
while(1);
}
/*********************************************************************************************
* name: delay
* func: delay time
* para: nTime -- input: the number of loop time, 100us resolution.
* ret: none
* modify:
* comment:
*********************************************************************************************/
void delay(int nTime)
{
int i;
for(i=100000;i>0;i--);
for(i=nTime;i>0;i--);
}
void beep(int BeepStatus)
{
if (BeepStatus==0)
rPDATE=rPDATE|0x8;
else
rPDATE=rPDATE&0x1f7;
}
/*********************************************************************************************
* name: port_init
* func: initialize io port for Embest teach kit ii
* para: none
* ret: none
* modify:
* comment:
*********************************************************************************************/
void port_init(void)
{
// CAUTION:Follow the configuration order for setting the ports.
// 1) setting value
// 2) setting control register
// 3) configure pull-up resistor.
//16bit data bus configuration
// PORT A GROUP
// 9 8 7 6 5 4 3 2 1 0
// A24 A23 A22 A21 A20 A19 A18 A17 A16 A0
// 0 1 1 1 1 1 1 1 1 1
rPCONA = 0x1ff;
// PORT B GROUP
// 10 9 8 7 6 5 4 3 2 1 0
// /CS5 /CS4 /CS3 /CS2 /CS1 GPB5 GPB4 /SRAS /SCAS SCLK SCKE
// EXT NIC USB IDE SMC NC NC Sdram Sdram Sdram Sdram
// ? ? ? ? ? Out Out ? ? ? ?
// 1 1 1 1 1 0 0 1 1 1 1
rPDATB = 0x7ff;
rPCONB = 0x1cf;
// PORT C GROUP, BUSWIDTH=16
// 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
// NC NC Uart1 Uart1 NC NC NC NC NC NC NC NC out out out out
// ? ? ? ? ? ? ? ? ? ? ? ? * * * * *
// 00 00 11 11 00 00 01 01 00 00 00 00 01 01 01 01
rPDATC = 0xfc00;
rPCONC = 0x0FF5FF55;
// rPCONC = 0x0ff0ff55; // EduKit-II
// rPCONC = 0x0ff0ffff; // S3CEV40
rPUPC = 0x30ff; // PULL UP RESISTOR should be enabled to I/O
// PORT D GROUP
// BIT7 6 5 4 3 2 1 0
// VF VM VLINE VCLK VD3 VD2 VD1 VD0
// 00 00 00 00 00 00 00 00
rPDATD = 0xff;
rPCOND = 0xaaaa;
rPUPD = 0x0;
// These pins must be set only after CPU's internal LCD controller is enable
// PORT E GROUP
// 8 7 6 5 4 3 2 1 0
// CODECLK Out Out Out ? Out(Beep) RXD0 TXD0 ?
// * * * * * * *
// 10 01 01 01 00 01 10 10 00
rPDATE = 0x1ff;
rPCONE = 0x25468;
rPUPE = 0x6;
// PORT F GROUP
// 8 7 6 5 4 3 2 1 0
// IISCLK IISDI IISDO IISLRCK Out Out Input IICSDA IICSCL
// * * * * * * * * *
// 100 100 100 100 01 01 00 10 10
rPDATF = 0xe7;
rPCONF = 0x24914A; // PF3:LED4 PF4:LED3 PF2:nWait
// rPCONF = 0x252A; //S3CEV40
rPUPF = 0x0;
// PORT G GROUP
// 7 6 5 4 3 2 1 0
// INT7 INT6 INT5 INT4 INT3 INT2 INT1 INT0
// S3 S4 S5 S6 NIC IDE USB
// *
// 11 11 11 11 11 11 11 11
rPDATG = 0xff;
rPCONG = 0xffff;
rPUPG = 0x0; // should be enabled
rSPUCR = 0x7; // D15-D0 pull-up disable
// Non Cache area
rNCACHBE0 = ((NON_CACHE_END>>12)<<16) | (NON_CACHE_START>>12);
// Low level default
rEXTINT = 0x0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -