📄 main.c
字号:
#include <stdio.h>
#include <stdlib.h>
#include "prototype.h"
#include "tortola_memory_map_defines.h"
int burst_led_blinkcode_to_flash(void);
/**********************************************************************
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)
#ifdef DEBUG
void test_exit(int err)
{
if (err)
printf("TEST FAILED!\n");
else
printf("\nTEST PASSED!\n");
printf ("END_TEST\n");
exit (err);
}
#endif
/*--------------------------------------------------------------------------
*
* FUNCTION NAME: main
*
* DESCRIPTION: main function
*
* EXTERNAL EFFECTS: None
*
* PARAMETERS: None
*
* RETURNS: Count of error if there was an error and 0 if there wasn't
*
*--------------------------------------------------------------------------*/
int 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);
EP1OutCommandSetup();
#endif
#ifdef DEBUG
U32 SourceAddress = 0x80010000;
U32 TargetAddress = CS0_BASE_ADDR;
U32 ByteCount = 0x40000;
int rc=0;
#endif
flash_loader(SourceAddress, TargetAddress, ByteCount,channel);
#ifdef HABTOOLKIT_FLASH_LIB
while (1);
#endif
#ifdef DEBUG
test_exit(rc);
return rc;
#endif
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -