📄 44btest.c
字号:
#include <stdlib.h>
#include <string.h>
#include "..\ucos_ii\ucos_ii.h" /* uC/OS interface */
#include "..\inc\option.h"
#include "..\inc\44b.h"
#include "..\inc\44blib.h"
#include "..\inc\def.h"
#include "../inc/target.h"
//#include "..\inc\cache.h"
//#include "..\inc\lcd.h"
//#include "..\inc\lcdlib.h"
//#include "..\inc\glib.h"
//#include "..\inc\clcd.h"
//#include "..\inc\adc.h"
//#include "..\inc\uart.h"
//#include "..\inc\power.h"
//#include "..\inc\dma.h"
#include "..\inc\timer.h"
//#include "..\inc\sio.h"
//#include "..\inc\rtc.h"
//#include "..\inc\etc.h"
//#include "..\inc\iic.h"
//#include "..\inc\eint.h"
//#include "..\inc\flash.h"
//#include "..\inc\iis.h"
//#include "..\inc\stop.h"
//#include "..\inc\idle.h"
//#include "..\inc\extdma.h"
//#include "..\inc\nwait.h"
//#include "..\inc\Am29f800.h"
//task stack size
#ifdef SEMIHOSTED
#define TASK_STACK_SIZE (SEMIHOSTED_STACK_NEEDS+64)
#else
#define TASK_STACK_SIZE 10*1024
#endif
/* Global Variable */
#define STACKSIZE 64
unsigned int Stack1[STACKSIZE];
unsigned int Stack2[STACKSIZE];
unsigned int Stack3[STACKSIZE];
unsigned int StackMain[STACKSIZE];
void AutoTest(void);
void Isr_Init(void);
void HaltUndef(void);
void HaltSwi(void);
void HaltPabort(void);
void HaltDabort(void);
//***************************************************************************
extern char Image$$RO$$Limit[];
extern char Image$$RO$$Base[];
extern char Image$$RW$$Limit[];
extern char Image$$RW$$Base[];
extern char Image$$ZI$$Limit[];
extern char Image$$ZI$$Base[];
//***************************************************************************
void Task1(void *Id)
{
for(;;)
{
Uart_SendByte('1');
OSTimeDly(1000);
}
}
void Task2(void *Id)
{
for(;;)
{
Uart_SendByte('2');
OSTimeDly(600);
}
}
void Task3(void *Id)
{
for(;;)
{
Uart_SendByte('3');
OSTimeDly(300);
}
}
/***************************************************************************/
void TaskStart(void *i)
{
char Id1 = '1';
char Id2 = '2';
char Id3 = '3';
ARMStartTimer();
OSStatInit();
OSTaskCreate(Task1, (void *)&Id1, &Stack1[STACKSIZE - 1], 5);
OSTaskCreate(Task2, (void *)&Id2, &Stack2[STACKSIZE - 1], 6);
OSTaskCreate(Task3, (void *)&Id3, &Stack3[STACKSIZE - 1], 7);
OSTaskDel(OS_PRIO_SELF);
}
/****************************************************************************
【功能说明】
****************************************************************************/
void About( void )
{
Uart_Printf( "\n" );
Uart_Printf( "**********************************************************************\n" ) ;
Uart_Printf( "\tS3C44B0X demo开发板\n" );
Uart_Printf( "\t NEU-INFO\n\n" );
Uart_Printf( "\t Image$$RO$$Base = %x\n", Image$$RO$$Base );
Uart_Printf( "\t Image$$RO$$Limit = %x\n", Image$$RO$$Limit );
Uart_Printf( "\t Image$$RW$$Base = %x\n", Image$$RW$$Base );
Uart_Printf( "\t Image$$RW$$Limit = %x\n", Image$$RW$$Limit );
Uart_Printf( "\t Image$$ZI$$Base = %x\n", Image$$ZI$$Base );
Uart_Printf( "\t Image$$ZI$$Limit = %x\n", Image$$ZI$$Limit );
Uart_Printf( "**********************************************************************\n" ) ;
Uart_Printf( "\n" );
Uart_Printf("\t★NEU-INFO S3C44B0X-BootLoader★\n");
Uart_Printf("\t\tBy Sun Hefei 2006.07.28\n");
}
//***************************************************************************
void Main(void)
{
ARMTargetInit();
Timer_PWM_Led(); //LED输出PWM信号
//ChangePllValue( 24, 2, 1 ); //修改系统主频为4倍频
//系统晶振为8MHz,4倍频系统运行在32MHz
About() ; //输出测试程序相关信息
//Uart_Printf("Now uC/OS II is running..................................\n");
//Isr_Init();
OSInit();
OSTimeSet(0);
Delay(5);
//OSTaskCreate(Task1, (void *)0, &Stack1[STACKSIZE - 1], 5);
//OSTaskCreate(Task2, (void *)0, &Stack2[STACKSIZE - 1], 6);
//OSTaskCreate(Task3, (void *)0, &Stack3[STACKSIZE - 1], 7);
OSTaskCreate(TaskStart,(void *)0, &StackMain[STACKSIZE - 1], 1);
/* Start the system running */
ARMTargetStart();
/* start the system */
OSStart();
/* never reached */
}
void Isr_Init(void)
{
pISR_UNDEF=(unsigned)HaltUndef;
pISR_SWI =(unsigned)HaltSwi;
pISR_PABORT=(unsigned)HaltPabort;
pISR_DABORT=(unsigned)HaltDabort;
//rINTCON=0x1; // Vectored Int. IRQ enable,FIQ disable
rINTCON=0x5; // Non-vectored,IRQ enable,FIQ disable
rINTMOD=0x0; // All=IRQ mode
rINTMSK=BIT_GLOBAL; // All interrupt is masked.
}
void HaltUndef(void)
{
Uart_Printf("Undefined instruction exception!!!\n");
while(1)
{
Led_Set( 0x00 ) ; //
Delay(500) ; //
Led_Set( 0x0f ) ; //
Delay(500) ; //
}
}
void HaltSwi(void)
{
Uart_Printf("SWI exception!!!\n");
while(1)
{
Led_Set( 0x00 ) ; //
Delay(500) ; //
Led_Set( 0x0f ) ; //
Delay(500) ; //
}
}
void HaltPabort(void)
{
Uart_Printf("Pabort exception!!!\n");
while(1)
{
Led_Set( 0x00 ) ; //
Delay(500) ; //
Led_Set( 0x0f ) ; //
Delay(500) ; //
}
}
void HaltDabort(void)
{
Uart_Printf("Dabort exception!!!\n");
while(1)
{
Led_Set( 0x00 ) ; //
Delay(500) ; //
Led_Set( 0x0f ) ; //
Delay(500) ; //
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -