📄 main.c
字号:
/******************************************************************************
** File Name: main.c *
** Author: Xueliang.Wang *
** DATE: 11/10/2005 *
** Copyright: 2005 Spreatrum, Incoporated. All Rights Reserved. *
** Description: *
******************************************************************************
******************************************************************************
** Edit History *
** ------------------------------------------------------------------------- *
** DATE NAME DESCRIPTION *
** 11/10/2005 Xueliang.Wang Create. *
******************************************************************************/
#ifndef _MAIN_C
#define _MAIN_C
/**---------------------------------------------------------------------------*
** Dependencies *
**---------------------------------------------------------------------------*/
#include "stdio.h"
#include "string.h"
#include "sci_types.h"
#include "sc6600d_reg.h"
#include "sio_drv.h"
#include "chip.h"
/**---------------------------------------------------------------------------*
** Compiler Flag *
**---------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/**---------------------------------------------------------------------------*
** Global Variables *
**---------------------------------------------------------------------------*/
/**---------------------------------------------------------------------------*
** Local Function Prototypes *
**---------------------------------------------------------------------------*/
/**---------------------------------------------------------------------------*
** Function Definitions *
**---------------------------------------------------------------------------*/
/*****************************************************************************/
// Description: This function is the main entry.
// Global resource dependence:
// Author: Xueliang.Wang
// Note:
/*****************************************************************************/
PUBLIC int main(void)
{
const char test_str[] = "\r\nWelcome to use Spreadtrum SC66600D Sample program. \r\n";
char str_buf[1000];
volatile uint32 tmp;
// Set ARM clock to 13MHz.
tmp = *(volatile uint32 *)GR_PCTL;
tmp = ((tmp >> 4) << 4) + 5;
*(volatile uint32 *)GR_PCTL = tmp;
//Initialize UART0.
SIO_Init(COM0);
//Print welcome string.
SIO_PutChars(COM0, test_str, sizeof(test_str));
//This is example code.
//User can modify it to do your own application program.
while(1)
{
tmp = CHIP_GetTickCount();
// Print a string every 10 s.
if ((tmp % 10000) == 0)
{
SIO_PutChars(COM0, test_str, sizeof(test_str));
}
// Print a string every 1 s.
if ((tmp % 1000) == 0)
{
sprintf(str_buf, "main(): Current time is %ld ms. \r\n", tmp);
SIO_PutChars(COM0, str_buf, strlen(str_buf));
}
}
return 0;
}
/*****************************************************************************/
// Description: This function loop output string.
// Global resource dependence:
// Author: Xueliang.Wang
// Note:
/*****************************************************************************/
PUBLIC void SCI_OutputStrLoop(const char * str)
{
SIO_PutChars(COM0, str, sizeof(str));
while(CHIP_GetTickCount() % 1000 == 0)
{
SIO_PutChars(COM0, str, sizeof(str));
}
}
/**---------------------------------------------------------------------------*
** Compiler Flag *
**---------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif // _MAIN_C
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -