📄 main.c
字号:
///////////////////////////////////////////////////////////////////////////////////////
//NAME: main.c (AMD Parallel Flash Programmer)
//DATE: 9/18/03
//PURPOSE: Program the Parallel Flash for the ADSP-21262 Ezkit
//
//USAGE: This file contains the main code for programming the PP flash on the
// ADSP-21262 Ezkit lite.
//
// If more than one file is to be programmed, either include all files in the
// same buffer (for contiguous location), or make sure that the files will not
// occupy any common 64K sectors in the flash, as programming the subsequent
// buffers will erase parts of the previously programmed buffers.
//
// For the AMD Am29LV081B the sectors occupy the following byte addresses:
// Sector Address Range
// SA0 0x00000 - 0x0FFFF
// SA1 0x10000 - 0x1FFFF
// SA2 0x20000 - 0x2FFFF
// SA3 0x30000 - 0x3FFFF
// SA4 0x40000 - 0x4FFFF
// SA5 0x50000 - 0x5FFFF
// SA6 0x60000 - 0x6FFFF
// SA7 0x70000 - 0x7FFFF
// SA8 0x80000 - 0x8FFFF
// SA9 0x90000 - 0x9FFFF
// SA10 0xA0000 - 0xAFFFF
// SA11 0xB0000 - 0xBFFFF
// SA12 0xC0000 - 0xCFFFF
// SA13 0xD0000 - 0xDFFFF
// SA14 0xE0000 - 0xEFFFF
// SA15 0xF0000 - 0xFFFFF
//
//
////////////////////////////////////////////////////////////////////////////////////////
#include "ppflash.h"
#include <signal.h>
//Declare the destination address in the flash of the file
#define LDR_START_ADDR 0x1000000
//Declare the width of the data in the file to determine the number of bytes
//Change this declaration in the LDF file also for correct packing.
#define FILE_DATA_WIDTH 16
//Declare a semaphore variable to use in the parallel port interrupt
int ppInterruptFlag = 0;
//Declare a variable in external memory to hold the file data to program
#pragma section("seg_ext", DMAONLY)
section("seg_ext") int ldr_source[] = {
#include "input.ldr"
};
//Main routine - add calls to blockWrite for each buffer holding file data
void main()
{
//Set up the interrupt for the parallel port
interrupt(SIG_PP,ppInterruptHandler);
//Workaround for C Runtime problem (fixed with patch released 10/03/2003)
interrupt(SIG_SP1, SIG_IGN);
//Call the block for each buffer holding the file data, pass the address of the
//buffer in SRAM, the address to program to in the flash, and the number of bytes to
//program.
blockWrite(ldr_source,(int *) LDR_START_ADDR,sizeof(ldr_source)*FILE_DATA_WIDTH/8);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -