📄 main.c
字号:
/******************************************************************************
C H E A D E R F I L E
ALL RIGHTS RESERVED
*******************************************************************************
Project Name : BONO System Test Program
Project No. :
Title :
File Name : main.c
Last Modified: 12/27/2005
(MM/DD/YYYY)
Description : Prototype definition header for BONO silicon system test program.
Assumptions :
Dependency Comments :
Project Specific Data :
History (MM/DD/YYYY) :
12/27/2005 - Initial Proposal
******************************************************************************/
#include <stdio.h>
#include "bono_memory_map_defines.h"
#include "common.h"
#include "MX27_HABTools.h"
/**********************************************************************
SDRAM / DDR
------------------------- Memory Start
| |
| Flash Library | => FLASH_LIB_SIZE ( now, 0x10000)
. .
. .
| |
------------------------- MEM_STORE_SOURCE_ADDR
| Src Addr |
------------------------- MEM_STORE_TARGET_ADDR
| Target Addr |
------------------------- MEM_STORE_BYTE_COUNT
| Byte Count |
------------------------- MEM_RESERVED
| Reserved |
------------------------- SourceAddress
| Image to be download |
| |
. .
. .
. .
. .
**********************************************************************/
#define PARAMETER_SIZE 0x10
#define FLASH_LIB_SIZE (0x10000 - PARAMETER_SIZE)
#define MEM_STORE_SOURCE_ADDR (CSD0_BASE_ADDR + FLASH_LIB_SIZE)
#define MEM_STORE_TARGET_ADDR (MEM_STORE_SOURCE_ADDR + 0x4)
#define MEM_STORE_BYTE_COUNT (MEM_STORE_SOURCE_ADDR + 0x8)
#define MEM_STORE_CHANNEL (MEM_STORE_SOURCE_ADDR + 0xC)
/* Modify SysInit() for different system initialization settings */
/****************************************************************
Private Functions
****************************************************************/
/*****************************************************************
Public Functions
*****************************************************************/
int32_t main(void)
{
#ifdef HABTOOLKIT_FLASH_LIB
U32 SourceAddress = *(volatile U32*)(MEM_STORE_SOURCE_ADDR);
U32 TargetAddress = *(volatile U32*)(MEM_STORE_TARGET_ADDR);
U32 ByteCount = *(volatile U32*)(MEM_STORE_BYTE_COUNT);
U32 channel = *(volatile U32*)(MEM_STORE_CHANNEL);
int rc=0;
EP1OutCommandSetup();
#endif
#ifdef DEBUG
U32 SourceAddress = 0xA0010000;
U32 TargetAddress = CS0_BASE_ADDR;
U32 ByteCount = 0x100000;
U32 channel = 0;
int rc=0;
#endif
GPT2Init();
//Fast Pad setting for WEIM signals
*(U32*)SYS_DSCR2=0x55555555;
*(U32*)SYS_DSCR3=0x55555555;
*(U32*)SYS_DSCR4=0x55555555;
*(U32*)SYS_DSCR7=0x55555555;
#ifdef DEBUG
printf ("Program Flash from RAM");
#endif
rc = FlashLoader(SourceAddress, TargetAddress, ByteCount, channel);
#ifdef DEBUG
printf ("\nResult : %s\n", rc ? "Fail" : "Pass");
#endif
if(!rc)
{
#ifdef HABTOOLKIT_FLASH_LIB
// send 3 OK to ensure that PC received the OK signal
//for ( i = 0; i < 3; i++)
while (1)
HAB_flash_status(FLASH_OK, 0, channel);
#endif
#ifdef DEBUG
printf("Flash Programming completed and PASS\n");
#endif
}
else
{
#ifdef HABTOOLKIT_FLASH_LIB
while (1)
HAB_flash_status(FLASH_VERIFY_ERROR, 0, channel);
#endif
#ifdef DEBUG
printf("Flash Programming completed and FAILED\n");
#endif
}
while (1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -