📄 main.c
字号:
/*****************************************************************************
** **
** Name: FIO pins, Interrupts, and Timer in C **
** **
******************************************************************************
(C) Copyright 2003 - Analog Devices, Inc. All rights reserved.
Pjoject Name: BF533 Flags C
Date Modified: 3/31/03 MK Ver 1.01
Software: VisualDSP++ 3.1
Hardware: ADSP-BF533 EZ-KIT Lite
Connections: Switch SW9_1 has to be turned on in order to connect SW7 to PF8
Purpose: To demonstrate the configuration of FIO pins, Timer, and
Interrupts in C
*****************************************************************************/
#include "BF533 Flags.h"
#include "ccblkfn.h"
#include "sysreg.h"
#include <stdio.h>
#include <string.h>
#include "UART.h"
//--------------------------------------------------------------------------//
// Variables //
//--------------------------------------------------------------------------//
// flag indicating direction of moving light (toggled in FlagA ISR)
short sLight_Move_Direction = 0;
//#define __IMG__
#ifdef __IMG__
extern int iProcImgMain(void);
//图像解码参数入口
extern void vIniParam(unsigned char* g_mem0);
#endif
#define ADD_SDRAM 0x06000000
//--------------------------------------------------------------------------//
// Function: main //
//--------------------------------------------------------------------------//
void main(void)
{
/*asm("SP.L = 0xFFFF;");
asm("SP.H = 0x0600;");
asm("SSYNC; ");
asm("FP.L = 0xFFFF;");
asm("FP.H = 0x0600;");
asm("SSYNC;");*/
char cBuf[200];
char *pSDRAM;
//unsigned char cImg[640*480];
int i;
pSDRAM = (char *)ADD_SDRAM;
//memset(cImg, 0, sizeof(cImg));
memset(cBuf, 0, sizeof(cBuf));
sprintf(cBuf, "%s", "\r\nTest Start\r\n");
sysreg_write(reg_SYSCFG, 0x32); //Initialize System Configuration Register
// SDRAM
/**pEBIU_SDRRC = 0x0817;
asm("ssync;");
*pEBIU_SDBCTL = 0x00000017;
asm("ssync;");
*pEBIU_SDGCTL = 0x0091998D;
asm("ssync;");*/
Init_Flags();
Init_Timers();
Init_EBIU();
Init_Flash();
Init_Interrupts();
*pFlashA_PortB_Data = 0x01;
UART_inititialize(0x1d);
asm("ssync;");
*pFlashA_PortB_Data = 0x02;
//while(1);
/*if(*pUART_DLL == 0x1d)
{
*pFlashA_PortB_Data |= 0x01;
}
if (*pUART_DLH == 0)
{
*pFlashA_PortB_Data |= 0x02;
} */
for(i = 0; i < 14; i++)
{
*(pSDRAM+i)= cBuf[i];
}
memset(cBuf, 0, sizeof(cBuf));
for(i = 0; i < 14; i++)
{
cBuf[i] = *(pSDRAM+i);
}
UART_puts(cBuf, strlen(cBuf));
*pFlashA_PortB_Data = 0x04;
/*for(i = 0; i < 1; i++)
{
memset(cBuf, 0, sizeof(cBuf));
UART_gets(cBuf, 5);
UART_puts(cBuf, strlen(cBuf));
}*/
#ifdef __IMG__
vIniParam((unsigned char *)pSDRAM);
*pFlashA_PortB_Data = 0x04;
i = iProcImgMain();
*pFlashA_PortB_Data = 0x08;
if(i == -1)
{
*pFlashA_PortB_Data = 0x02;
}
else if(i == -2)
{
*pFlashA_PortB_Data = 0x04;
}
else
{
*pFlashA_PortB_Data = 0x08;
}
#endif
sprintf(cBuf, "%s", "\r\nTest Over\r\n");
UART_puts(cBuf, strlen(cBuf));
while(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -